I have this PHP code:
$a=array(1, 2, 3);
var_dump(current($a));
each($a);
each($a);
each($a);
var_dump(current($a));
$b=$a;
var_dump(current($a));
The output is "int(1) bool(false) int(1)" but I expect "int(1) bool(false) bool(false)", because after three times each the internal pointer of $a should be after the end of the array and stay there.
But apparently the assignment $b=$a sets the pointer of $a back to the first element again. What is going on here?
(If I remove one each, the output is "int(1) int(3) int(3)" as expected.)