3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getLengthOfMissingArray($arrayOfArrays) { if(! is_array($arrayOfArrays)) { return 0; } $values = array_map(function($array) { return count($array); }, $arrayOfArrays); if(count($values) == 0) { return 0; } for($i = min($values); $i <= max($values); $i++) { if($key = array_search($i, $values) === false) { return $i; } } return 0; } echo getLengthOfMissingArray([[35,37],[27,4,46,38],[29,37,45,31,33,33],[],[20,8,47,15,48,10,10],[24],[31,32,31,24,21]]);
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
3