3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { $a = array_merge($a, array(6, 7)); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { $a[] = 6; $a[] = 7; } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, 6); array_push($a, 7); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, 6, 7); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, array(6, 7)); } }
based on 87AV3
Output for 4.3.0 - 7.2.0
1234512345123451234512345