Your SlideShare is downloading. ×
  • Like
Session3
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
293
On SlideShare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. PHP Function projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 2. PHP Function F function function( F F ก F F ) { …….. ; …….. ; return F F ก F ก ; } projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 3. PHP Function <?php echo hello(); function hello() { return "hello"; } ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 4. PHP Function <?php echo showNum(1); function showNum($n) { if($n=="1") {return 1;} else if($n=="2") {return 2;} } ?> projectsoft.biz ก Web Application F PHP MySQL Ajax(jquery)
  • 5. PHP Function showStart(3); function showStart($n){ $count1=1; while($count1<=$n){$count2=1; while($count2<=$count1) {echo "*";$count2++;} echo "<br />"; $count1++;} } projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 6. PHP Sub String Function substr(string,start position,length ); F <?php $str="abc"; echo substr($str,1,1); ?> F F b projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 7. PHP Sub String Function <?php $str="abc"; echo substr($str,1); ?> F F F bc F ก F F F F projectsoft.biz ก PHP MySQL Ajax(jquery) ˈ F F string F F Web Application F string F ก F ก string F F
  • 8. PHP Sub String Date <?php echo showDate("2010-10-18"); function showDate($date) { $day=substr($date,8,2); $month=substr($date,5,2); $year=substr($date,0,4); return $day."/".$month."/".$year; } ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 9. PHP String Replace <?php $str="hello WORLD"; echo str_replace("hello","HELLO",$str); ?> F F HELLO WORLD ก F F F string ก F ก F ก F string F string F projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F string
  • 10. PHP String Replace <?php $str="anbncn"; echo str_replace("n","<br />",$str); ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 11. PHP String Length Function strlen() F <?php echo strlen("php"); ?> F F ˈ php projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F ก ก F 3 string F ก
  • 12. PHP String Length <?php $str="12345"; if(strlen($str)>6){echo "greater than 6 ";} else{echo “less than 6”;} ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 13. PHP String Position strpos($string, "find string") Function strpos F F F F string $string string ก find string ก F ก <?php $str="@bc"; echo strpos($str,"@"); ?> ก F ก 0 ก F 0 projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F F ก F ก F F F F Fก F F F
  • 14. PHP String Position ก F F ก F function strpos return false <?php $mystring = 'bc'; $findme = 'a'; $pos = strpos($mystring, $findme); if ($pos === false) { echo "The string ”.$findme.“ was not found in the string”; } ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 15. F ก ก file <?php $file_name="my_picture.jpg"; $type = substr($file_name, strpos($file_name,".")); echo $type; ?> F ก .jpg projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 16. ก string ก string ก ก function strtolower() <?php $str1="HeLLoWoRLd"; $str2=strtolower($str1); echo $str2; ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F ก F ˈ F ˈ F ก F ก F F
  • 17. ก string ก string ก ก function strtoupper() <?php $str1=“heLLoWoRld"; $str2= strtoupper($str1); echo $str2; ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F ก F ˈ F ˈ F F F F F F
  • 18. F function date() ʾ ก F ก ˆ function date() F • date("d/m/Y") • ก F ก F ˆ • date("H:i:s") projectsoft.biz ก PHP MySQL Ajax(jquery) / ʾ / • ˆ Web Application F ˈ : F : F
  • 19. ʾ • • • • • • • • F function date() function date() F ก F ˈ d m Y ʾ .. ก y ʾ .. ก H ˈ i s projectsoft.biz ก PHP MySQL Ajax(jquery) F parameter ʾ Web Application F ˈ sting F
  • 20. ก F <?php $strDate1="2012-01-01";// F $strDate2="2012-02-1";// echo DateDiff($strDate1,$strDate2); // ก function DateDiff F F F // F function DateDiff F F $strDate1 $strDate2 function DateDiff($strDate1,$strDate2) { // ˈ F // F F 86400 ( 1 86400 ) F return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 ); } ?> projectsoft.biz PHP MySQL Ajax(jquery) ก Web Application F
  • 21. ก /F <?php //ก echo date('Y-m-d', strtotime(' +1 day'));// n php F echo date('Y-m-d', strtotime('+60 day', strtotime("2012-5-2"))); // ก 2 2554 60 //ก กF F echo date('Y-m-d', strtotime(' -1 day'));// echo date('Y-m-d', strtotime('-60 day', strtotime( "2012-1-31" ))); // F ก 1 2554 60 ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 22. PHP Include projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 23. PHP include include(“ F.php”); include(“ .php”); F ก F include F F F include1_1.php <?php echo "Hello ";?> <?php include("include1_1.php"); echo " World"; ?> F F Hello World projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F F
  • 24. PHP include F F include1_1.php F folder include F ก <?php include("include/include1_1.php"); echo " World"; ?> F F F F projectsoft.biz ก PHP MySQL Ajax(jquery) ˈ Hello World F ก F Web Application F F F F F ก include
  • 25. PHP include + Function F showDate.php F function F <?php function showDate($date) { $day=substr($date,8,2); $month=substr($date,5,2); $year=substr($date,0,4); return $day."/".$month."/".$year; } ?> projectsoft.biz ก PHP MySQL Ajax(jquery) Web Application F
  • 26. PHP + Include <?php include("function/showDate.php"); $date=showDate("2010-10-01"); echo $date; ?> F include projectsoft.biz ก PHP MySQL Ajax(jquery) function showDate F Web Application F