function myFunc( $number = 8 ) {
}
If client will pass a number to that function like myFunc( 11 ), then $number value will be 11. But if user will call it without argument or parameter, the $number variable will have value of
PHP Coding tips & tricks. Function & error explanation, coding style, how tos etc. Short notes posted directly from developer work environment.
PHP Coding Tips
Showing posts with label parameter. Show all posts
Showing posts with label parameter. Show all posts
Monday, August 20, 2012
PHP Function default parameter value
You can set default parameter value for method or function by giving it's initial value at argument declaration, see example:
Subscribe to:
Posts (Atom)