1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 21:11:02 +02:00
Files
archived-php-src/tests/lang/foreachLoop.011.phpt
Nikita Popov 45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00

34 lines
487 B
PHP

--TEST--
Changing from an interable 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';
}
?>
--EXPECTF--
Change from array to non iterable:
int(1)
int(2)
int(3)
Change from object to non iterable:
int(1)
int(2)