func_get_args() func_get_arg(offset) func_num_args(); 函数使用
func_get_args是获取方法中参数的数组,返回的是一个数组,与func_num_args搭配使用;
func_get_arg是获取指定偏移量的参数
func_num_args统计参数个数
func_num_args一般写在方法中,用于计数;
使用方法如下:
[php]
function myargs($a='para1',$b='para2'){
$numargs = func_num_args();
echo "Number of parameters : $numargs
\n";
if ($numargs >= 2) {
echo "Second parameters is: " . func_get_arg(1) . "
\n";
}
$arg_list = func_get_args();
for ($i = 0; $i
echo "parameters $i is: " . $arg_list[$i] . "
\n";
}
}
myargs(11, 22);
将会输出:
Number of parameters : 2
Second parameters is: 22
parameters 0 is: 11
parameters 1 is: 22
function myargs($a='para1',$b='para2'){
$numargs = func_num_args();
echo "Number of parameters : $numargs
\n";
if ($numargs >= 2) {
echo "Second parameters is: " . func_get_arg(1) . "
\n";
}
$arg_list = func_get_args();
for ($i = 0; $i
echo "parameters $i is: " . $arg_list[$i] . "
\n";
}
}
myargs(11, 22);
将会输出:
Number of parameters : 2
Second parameters is: 22
parameters 0 is: 11
parameters 1 is: 22

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)
