我需要一些帮助,即使我认为我正在检查数组的长度并且我应该跳出循环,我仍然在我的 [else if ($value....] 行上收到警告。所以要么我遗漏了一些重要的东西,或者我一直盯着这个代码段太久,而且很明显。任何见解都将不胜感激。
$count = count($filter); //Filter is an array
if ($count > 1 ){
//Compare values and generate a range to choose from
$i = 1;
foreach($filter as $value){
//Break the loop if at the end of the array
if ($i >= $count){
//throw new exception($i .' '.$count);
break;
}
//if the value is smaller then the next procceding value, because they are already in order of presidence,
//add it to our range of potentials.
else if($value < $filter[$i]->value){
array_push($range, key($filter));
}
$i++;
}
}else {
return false;
}