首頁  >  文章  >  後端開發  >  php指定函数参数默认值示例代码_PHP教程

php指定函数参数默认值示例代码_PHP教程

WBOY
WBOY原創
2016-07-13 17:18:06932瀏覽

例1

复制代码 代码如下:



php函数指定默认值-www.jbxue.com


function printMe($param = NULL)
{
   print $param;
}
printMe("This is test");
printMe();
?>



输出结果:
This is test

例2 php函数参数默认值的使用范例,php函数参数中设置和使用默认值。

复制代码 代码如下:


 
  php函数参数默认值 - www.jbxue.com
 
 
    function textonweb ($content, $fontsize=3){
     echo "$content";
  }
  textonweb ("A
", 7);
  textonweb ("AA.
");
  textonweb ("AAA.
");
  textonweb ("AAAA!
");
  ?>
 
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/621702.htmlTechArticle例1 复制代码 代码如下: html head titlephp函数指定默认值-www.jbxue.com/title /head body ?php function printMe($param = NULL) { print $param; } printMe("This is test"...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn