I just have found out that there is a function called func_get_arg
in PHP which enables developer to use variant style of getting arguments.
It seems to be very us
Gets an array of the function's argument list.
This function may be used in conjunction with func_get_arg()
and func_num_args()
to allow user-defined functions to accept variable-length argument lists.
= 2) {
echo "Second argument is: " . func_get_arg(1) . "\n";
}
$arg_list = func_get_args();
for ($i = 0; $i < $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "\n";
}
}
foo(1, 2, 3);
?>