The content of this section:
PHP functions Specify default values
In PHP programming, the default value is set for a custom function, and when the user calls the function, the parameter is replaced with a default value if the parameter is not assigned a value.
Example 1,
Copy CodeThe code is as follows:
<title>PHP functions Specify default values-www.jb51.net</title>
function printMe ($param = NULL)
{
Print $param;
}
PrintMe ("This is Test");
PrintMe ();
?>
Output Result:
This is test
Example of using the default value of the 2,php function parameter, set and use the default value in the PHP function parameter.
Code:
Copy the Code code as follows:
php function parameter default value-Www.jb51.net
function Textonweb ($content, $fontsize =3) {
echo "$content";
}
Textonweb ("A
", 7);
Textonweb ("AA.
");
Textonweb ("AAA.
");
Textonweb ("aaaa!
");
?>
http://www.bkjia.com/PHPjc/621698.html www.bkjia.com true http://www.bkjia.com/PHPjc/621698.html techarticle in this section: PHP functions specify default values in PHP programming, default values are set for custom functions, and when the user calls the function, the parameter is replaced with the default value if it is not given a value ...