php-src/Zend/tests/foreach.phpt
2018-10-14 12:07:20 -03:00

26 lines
273 B
PHP

--TEST--
foreach() by-ref bug
--FILE--
<?php
$foo = array(1,2,3,4);
foreach($foo as $key => &$val) {
if($val == 3) {
$foo[$key] = 0;
} else {
$val++;
}
}
var_dump($foo);
?>
--EXPECT--
array(4) {
[0]=>
int(2)
[1]=>
int(3)
[2]=>
int(0)
[3]=>
&int(5)
}