mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
d9adb6715f
# Patch from Brian Shire
26 lines
274 B
PHP
26 lines
274 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)
|
|
}
|