1--TEST-- 2Foreach by reference and inserting new element when we are already at the end 3--FILE-- 4<?php 5$a = [1]; 6foreach($a as &$v) { 7 echo "$v\n"; 8 $a[1]=2; 9} 10?> 11--EXPECT-- 121 132 14