1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/tests/lang/foreachLoop.011.phpt
2024-07-10 00:11:36 +01:00

33 lines
493 B
PHP

--TEST--
Changing from an iterable type to a non iterable type during the iteration
--FILE--
<?php
echo "\nChange from array to non iterable:\n";
$a = array(1,2,3);
$b=&$a;
foreach ($a as $v) {
var_dump($v);
$b=1;
}
echo "\nChange from object to non iterable:\n";
$a = new stdClass;
$a->a=1;
$a->b=2;
$b=&$a;
foreach ($a as $v) {
var_dump($v);
$b='x';
}
?>
--EXPECT--
Change from array to non iterable:
int(1)
int(2)
int(3)
Change from object to non iterable:
int(1)
int(2)