func_get_args

Returns an array comprising a function's argument list

Syntax

func_get_args(): array

Return

Returns an array in which each element is a copy of the corresponding member of the current user-defined function's argument list.

Examples

1

<?

function myfunction()
{
    $return = func_get_args();

    print_r($return);
}

myfunction("a", "b", "c");
myfunction("d", "e", "f", "g");
myfunction("h", "i");

?>
Array
(
    [0] => a
    [1] => b
    [2] => c
)
Array
(
    [0] => d
    [1] => e
    [2] => f
    [3] => g
)
Array
(
    [0] => h
    [1] => i
)

2

<?

function myfunction()
{
    $return = func_get_args();

    for($i = 0; $i < func_num_args(); ++$i)
    {
        echo "$i: $return[$i]\n";
    }
    echo "\n";
}

myfunction("a", "b", "c");
myfunction("d", "e", "f", "g");
myfunction("h", "i");

?>
0: a
1: b
2: c

0: d
1: e
2: f
3: g

0: h
1: i

call_user_func

call_user_func_array

forward_static_call

forward_static_call_array

func_get_arg

func_num_args

function_exists

get_defined_functions

register_shutdown_function

register_tick_function

unregister_tick_function

PHP

Home Menu