加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-12 19:59:02 所属栏目:PHP教程 来源:网络整理
导读:例1 代码如下: php函数指定默认值-www.jb51.cc function printMe($param = NULL) { print $param; } printMe("This is test"); printMe(); ?> 输出结果: This is test 例2 php函数参数默认值的使用范例,php函数参数中设置和使用默认值。 代码如下: php函数

例1

代码如下:


php函数指定默认值-www.52php.cn


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

输出结果:
This is test

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

代码如下:


php函数参数默认值 - www.52php.cn


function textonweb ($content,$fontsize=3){
echo "$content";
}
textonweb ("A
",7);
textonweb ("AA.
");
textonweb ("AAA.
");
textonweb ("AAAA!
");
?>


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读