I have an array like this :
array (size=3)
0 =>
array (size=2)
'score' => float 17.891873624039
1 =>
array (size=2)
'score' => float 17.883449353824
2 =>
array (size=2)
'score' => float 4.702030124427
and have a while loop like this:
$offset=1;
while($scoreList[$rank+$offset]!=NULL && $scoreList[$rank]["score"]==$scoreList[$rank+$offset]["score"])
{
//do something
$offset++;
}
I need to check if the next index in the array exists and at the same time check if it is equal to the current object but I get
Undefined offset:4
I cannot put the second condition in an if statement because offset should be increased if these two indexes are equal so it falls in an infinite loop if I put it in if clause.
Aucun commentaire:
Enregistrer un commentaire