Usage of php func_num_args() function

怪我咯
Release: 2023-03-12 21:04:01
Original
1300 people have browsed it

This article mainly introduces the usage of PHP function func_num_args, and analyzes in detail the related usage skills of func_num_args function returning function parameters in the form of examples, which has certain reference value. Friends who need it can refer to

The examples in this article describe the usage of the PHP function func_num_args. Share it with everyone for your reference, the details are as follows:

function foo()
{
   $numargs = func_num_args();//返回这个函数所含的参数
   echo "Num fo argumets : $numargs <br>\n";
   $arr=func_get_args();//返回一个数组给$arr
   print_r($arr);//输出这个数组所有的参数
   echo "<hr>";
   for($i=0;$i<=$numargs;$i++)
   {
       echo $arr[$i]."<br>";
   }
}
foo(1,2,3,45,6);
Copy after login

The running results are as follows:

Num fo argumets : 5 
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 45 [4] => 6 ) 
--------------------------------------------------------------------------------
1
2
3
45
6
Copy after login

The above is the detailed content of Usage of php func_num_args() function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!