Php specifies the sample code for the default function parameter value. Example 1 copy the code as follows: the htmlheadtitlephp function specifies the default value-www. jbxue. comtitleheadbody? PhpfunctionprintMe ($ paramNULL) {print $ param;} printMe (Thisistest Example 1
The code is as follows:
Php function specifies the default value -www.jbxue.com
Function printMe ($ param = NULL)
{
Print $ param;
}
PrintMe ("This is test ");
PrintMe ();
?>
Output result:
This is test
Example 2 use the default values of php function parameters. set and use the default values in php function parameters.
The code is as follows:
Default value of php function parameters-www.jbxue.com
Function textonweb ($ content, $ fontsize = 3 ){
Echo "$ content ";
}
Textonweb ("
", 7 );
Textonweb ("AA.
");
Textonweb ("AAA.
");
Textonweb ("AAAA!
");
?>
The authorization code is as follows: the html head titlephp function specifies the default value -www.jbxue.com/title/head body? Php function printMe ($ param = NULL) {print $ param;} printMe ("This is test "...