mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
19 lines
252 B
PHP
19 lines
252 B
PHP
--TEST--
|
|
array_walk() function precerve foreach by reference iterator pointer
|
|
--FILE--
|
|
<?php
|
|
$a = [1,2,3,4,5];
|
|
foreach($a as &$v) {
|
|
echo "$v\n";
|
|
if ($v == 3) {
|
|
array_walk($a, function (&$x) {$x+=10;});
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
1
|
|
2
|
|
3
|
|
14
|
|
15
|