1--TEST-- 2Changing from an interable type to a non iterable type during the iteration 3--FILE-- 4<?php 5echo "\nChange from array to non iterable:\n"; 6$a = array(1,2,3); 7$b=&$a; 8foreach ($a as $v) { 9 var_dump($v); 10 $b=1; 11} 12 13echo "\nChange from object to non iterable:\n"; 14$a = new stdClass; 15$a->a=1; 16$a->b=2; 17$b=&$a; 18foreach ($a as $v) { 19 var_dump($v); 20 $b='x'; 21} 22 23?> 24--EXPECTF-- 25Change from array to non iterable: 26int(1) 27int(2) 28int(3) 29 30Change from object to non iterable: 31int(1) 32int(2) 33