-
- php function specifies the default value -bbs.it-home.org
- < ?php
- function printMe($param = NULL)
- {
- print $param;
- }
- printMe("This is test");
- printMe();
- ?>
-
- html>
Copy code
Output results:
This is test
Example 2, example of using default values of php function parameters, setting and using default values in php function parameters.
Code:
-
-
- php function parameter default value - bbs.it-home.org
-
-
- < ;?php
- function textonweb ($content, $fontsize=3){
- echo "$content";
- }
- textonweb ("A
", 7);
- textonweb ("AA.
");
- textonweb ("AAA.
");
- textonweb ("AAAA!
");
- ? >
-
-
Copy code
|