Answers for "php get arguments of a function"

PHP
0

php get all function arguments

<?php
function foo()
{
    $numargs = func_num_args();
    echo "Number of arguments: $numargs \n";
    if ($numargs >= 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);
?>
Posted by: Guest on July-14-2020
0

PHP Parameters

1
add_action( $hook, $function_to_add, $priority, $accepted_args );
Posted by: Guest on January-12-2022

Code answers related to "php get arguments of a function"

Browse Popular Code Answers by Language