mirror of
https://github.com/php/php-src.git
synced 2024-09-30 22:36:12 +00:00
19 lines
260 B
Plaintext
19 lines
260 B
Plaintext
|
--TEST--
|
||
|
array_unshift() function precerve foreach by reference iterator pointer
|
||
|
--FILE--
|
||
|
<?php
|
||
|
$a = [1,2,3];
|
||
|
foreach($a as &$v) {
|
||
|
echo "$v\n";
|
||
|
if ($v == 2) {
|
||
|
array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0);
|
||
|
}
|
||
|
}
|
||
|
var_dump(count($a));
|
||
|
?>
|
||
|
--EXPECT--
|
||
|
1
|
||
|
2
|
||
|
3
|
||
|
int(11)
|