網頁

2009/1/22

php講義 work8 自訂函數

 自訂函數,讓你的程式結構更清楚。


表一 php自訂函數
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
<?php
function showmesg($mesg){
  $element = explode(",",$mesg);
  echo "以下是".$element[0]."在".$element[1]."的留言:<br>";
  echo "<font size=20>".$element[2]."</font><br>";
  echo "<hr>";
}
$note = "王大德,2009.1.22,我今天吃很飽";
showmesg($note);
?>

沒有留言: