php的函数可以设定默认值,当用户调用该函数时,如果不给参数指定值,参数会用默认值顶替
<html> <head> <title>Writing PHP Function which returns value</title> </head> <body> <?php function printMe($param = NULL) { print $param; } printMe("This is test"); printMe(); ?> </body> </html>
输出结果如下
This is test