The difference between func_get_args of func_get_arg of func_num_args of in PHP

  • 2020-10-23 20:03:44
  • OfStack


<?php    
 function jb51(){        
    print_r(func_get_args());   
    echo "<br>";   
    echo func_get_arg(1);   
    echo "<br>";   
    echo func_num_args();      
}   

jb51("www","jb51","net");   
?>

Output results:

Array ( [0] = > blog [1] = > micxp [2] = > com )
micxp
3

We can see from the above results

The func_get_args() function returns an array containing all the arguments to the current function
The func_get_arg() function returns the value of the argument at the specified location
func_num_args() returns the number of arguments to the current function and returns a number


Related articles: