<?php
function isProgression($array){
return ($array == range(0, $array[sizeof($array)-1]));
}
function isProgression2($array){
$count = count($array);
for ($i = 0; $i < $count; ++$i) {
if($array[$i] != $i){
return true;
}
}
return false;
}
for ($x = 0; $x < 10000; $x++) {
// Pick one
isProgression(array(0,1,2,3,4,5));
//isProgression2(array(0,1,2,3,4,5));
}
preferences:
46.58 ms | 402 KiB | 5 Q