3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array(); $test[1] = 'a'; $test[4] = 'd'; $test[2] = 'b'; $test[3] = 'c'; $i=0; $count=0; $aoi_result = array(); while($count < 2 || $i <= 11) { if (isset($test[++$i])) { $count++; $aoi_result[$count] = $test[$i]; } } var_dump($aoi_result);
based on QvbrH
Output for 4.3.0 - 7.2.0
array(4) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" [4]=> string(1) "d" }