Home >Backend Development >PHP Tutorial >为什么$aar输出时41

为什么$aar输出时41

WBOY
WBOYOriginal
2016-06-23 13:46:321042browse

<?phpfunction foo($aaar){    var_dump($aaar);    $numargs = func_num_args();    echo "Number of arguments: $numargs<br />\n";    if ($numargs >= 2) {        echo "Second argument is: " . func_get_arg(1) . "<br />\n";    }    $arg_list = func_get_args();    for ($i = 0; $i < $numargs; $i++) {        echo "Argument $i is: " . $arg_list[$i] . "<br />\n";    }}foo(1, 2, 3);?>


回复讨论(解决方案)

int(1) Number of arguments: 3
Second argument is: 2
Argument 0 is: 1
Argument 1 is: 2
Argument 2 is: 3

很正常啊。

?於看明白了,41的意思是 “是1"

?甚?是1,因?foo(1,2,3) 第一???是1,所以$aaar就是1.

????形?,很正常。

如果
function foo($aaar, $bbbr)
foo('a','b','c','d');

$aaar = a
$bbbr = b

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