$arr=array("a","b","c","d");
foreach ($arr as &$value) {
}
//$value=&arr[3];$value="d";
foreach ($arr as $key=>$value) {
echo "";
var_dump($arr);
}
the results are as follows
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"
}
I would like to ask that $value=&arr [3] has been determined before the second foreache function; then the following
$value=$arr [0] in the first loop; whether it completely covers the first $value,
and why, and the last value is whether abcc, can be explained from the zval structure