3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(1,2,3); $b = &$a; foreach($a as $i => $v) { echo "$v\n"; unset($a[i]); } var_dump($a); var_dump($b);
based on Fp0Aa
Output for 7.2.0
1 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/aSWrf on line 7 2 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/aSWrf on line 7 3 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/aSWrf on line 7 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
Output for 5.3.19 - 7.1.10
1 Notice: Use of undefined constant i - assumed 'i' in /in/aSWrf on line 7 2 Notice: Use of undefined constant i - assumed 'i' in /in/aSWrf on line 7 3 Notice: Use of undefined constant i - assumed 'i' in /in/aSWrf on line 7 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }