1
2<?php
3function foo()
4{
5 $numargs = func_num_args();
6 echo "Number of arguments: $numargs \n";
7 if ($numargs >= 2) {
8 echo "Second argument is: " . func_get_arg(1) . "\n";
9 }
10 $arg_list = func_get_args();
11 for ($i = 0; $i < $numargs; $i++) {
12 echo "Argument $i is: " . $arg_list[$i] . "\n";
13 }
14}
15
16foo(1, 2, 3);
17?>
18
19