Func_get_args is an array that gets the arguments in the method, and returns an array that is used in conjunction with the Func_num_args;
Func_get_arg is the parameter that gets the specified offset
Func_num_args Number of statistical parameters
Func_num_args is generally written in the method for counting;
Here's how to use it:
[PHP]
function Myargs ($a = ' para1 ', $b = ' para2 ') {
$numargs = Func_num_args ();
echo "Number of parameters: $numargs
\ n ";
if ($numargs >= 2) {
echo "Second parameters is:". Func_get_arg (1). "
\ n ";
}
$arg _list = Func_get_args ();
for ($i = 0; $i < $numargs; $i + +) {
echo "Parameters $i is:". $arg _list[$i]. "
\ n ";
}
}
Myargs (11, 22);
The output will be:
Number of Parameters:2
Second Parameters is:22
Parameters 0 Is:11
Parameters 1 is:22
function Myargs ($a = ' para1 ', $b = ' para2 ') {
$numargs = Func_num_args ();
echo "Number of parameters: $numargs
\ n ";
if ($numargs >= 2) {
echo "Second parameters is:". Func_get_arg (1). "
\ n ";
}
$arg _list = Func_get_args ();
for ($i = 0; $i < $numargs; $i + +) {
echo "Parameters $i is:". $arg _list[$i]. "
\ n ";
}
}
Myargs (11, 22);
The output will be:
Number of Parameters:2
Second Parameters is:22
Parameters 0 Is:11
Parameters 1 is:22
http://www.bkjia.com/PHPjc/477547.html www.bkjia.com true http://www.bkjia.com/PHPjc/477547.html techarticle Func_get_args is an array that gets the arguments in the method, returns an array that is used with the Func_num_args, Func_get_arg is the parameter that gets the specified offset Func_num_args the number of statistical parameters ...