3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $bigArray = array(); $smallArray1 = array('k1' => 1); $bigArray[] = $smallArray1; $someFlag = true; $smallArray2 = array('k2' => 2); if($someFlag) $bigArray[] = $smallArray2; var_dump($bigArray);
Output for 5.4.40 - 7.1.10
array(2) { [0]=> array(1) { ["k1"]=> int(1) } [1]=> array(1) { ["k2"]=> int(2) } }