$rua[] = {1,1,2,2,2,2};
$countRua = count($rua, COUNT_RECURSIVE);
for ($i=0; $i < $countRua; $i++) {
if ($rua[$i] == $rua[$i+1]) {
}
}
I have for
above traversing a array
and validating if the position is equal to the next position, but when it arrives in the last it tries to compare with position 7 and returns the error below, some way to adjust it?
Undefined offset: 6