$arr=array("a","b","c","d");
foreach ($arr as &$value) {
}
//$value=&arr[3];$value="d";
foreach ($arr as $key=>$value) {
echo "<pre>";
var_dump($arr);
}
结果如下
array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
&string(1) "a"
}
array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
&string(1) "b"
}
array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
&string(1) "c"
}
array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
&string(1) "c"
}
我想问下,第二个foreache函数前,已经确定了$value=&arr[3];那么下面的
在第一次循环时$value=$arr[0];是否完全覆盖了第一个$value时,
还有为什么,最后的值是abcc,能否从zval结构解释下吗
凤凰求蛊