Home  >  Article  >  Backend Development  >  The difference between func_get_args(), func_get_arg(), and func_num_args() in PHP_PHP Tutorial

The difference between func_get_args(), func_get_arg(), and func_num_args() in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:13:24800browse

Copy code The code is as follows:

function jb51(){ ());
echo "
";
echo func_get_arg(1);
echo "
";
echo func_num_args();
}

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

Output result:

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

micxp
3

We can see from the above results

func_get_args() This function returns an array containing all the parameters of the current function

func_get_arg() The function returns the value of the parameter at the specified position
func_num_args() This function returns the parameters of the current function The quantity returned is a number

http://www.bkjia.com/PHPjc/313503.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313503.htmlTechArticleCopy the code as follows: ?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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn