note 5239 modified in Function arguments by zak

From: Date: Tue, 12 Dec 2000 08:04:53 +0000
Subject: note 5239 modified in Function arguments by zak
Groups: php.notes 
Request: Send a blank email to php-notes+get-8639@lists.php.net to get a copy of this message
You may pass any number of extra parameters to a function, regardless of the prototyping. In addition, the arguments passed to a function will be available via the variable names defined in the function prototype, as well as via the func_get_arg() and func_get_args() functions. For example: function printme ($arg) { for ($ndx = 0; $ndx < $num_args; ++$ndx) $output .= func_get_arg ($ndx); print $output; } printme ("one ", "two"); # This prints "one two". This behavior is useful for setting default values for function arguments and for ensuring that a certain number of arguments get passed to a function. http://www.php.net/manual/function-arguments.php

« previous php.notes (#8639) next »