Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

func_get_args

Description

The func_get_args of Function Handling for PHP 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

HomeMenu