This article analyzes the usage of a function in PHP that defines a parameter with a default value. Share it with everyone for your reference. The specific analysis is as follows:
PHP function parameters can specify default values. After specifying the default value, if you do not assign a value to the parameter when calling, the parameter will use the default value
<?php function capitalize( $str, $each=TRUE ) { $str = strtolower($str); if ($each === TRUE) { $str = ucwords ($str); } else { $str = strtoupper($str); } echo ("$str <br />"); } capitalize("hEllo WoRld!"); capitalize("hEllo WoRld!",FALSE); ?>
I hope this article will be helpful to everyone’s PHP programming design.