3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arrs = array(); $arrs[] = array('something1', 2); $arrs[] = array('something3', 'something4'); $arrs[] = array(); $arrs[] = array('something1', 3.12); $list = array(); foreach($arrs as $key=>$arr) { if(is_array($arr)) { echo $key; echo ", "; $list = array_merge($list, $arr); } else{ echo $key; echo " not array"; } } print("<br>"); print_r($list);
Output for 4.3.0 - 7.1.0
0, 1, 2, 3, <br>Array ( [0] => something1 [1] => 2 [2] => something3 [3] => something4 [4] => something1 [5] => 3.12 )