September 2001
Intermediate to advanced
768 pages
32h 45m
English
int func_num_args(void)
Gets the number of arguments passed to a function.
Returns:
The number of arguments passed to a user function; -1 if func_num_args() is called in global scope
Description:
func_num_args() returns the number of arguments that have been passed to a user-defined function. It’s most often used in conjunction with func_get_arg() and func_get_args() to ensure that the right number of arguments have been passed to a function.
Availability:
UNIX, Windows
Version:
4.0b4+
See also:
func_get_arg() func_get_args()
Examples:
<pre> <?php function demo () { $num_args = func_num_args(); print "The function was passed $num_args argument(s).\n"; } demo (); demo ('A single argument'); ... |
Read now
Unlock full access