1
$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 own the for
up through a array
and validating if the position is equal to the next position however, when it arrives at the last it tries to compare with position 7 and returns the error below, some way to adjust it ?
Undefined offset: 6
It compares with the one in front can not go to the end
– Isac
for the use of
COUNT_RECURSIVE
? can give aisset()
in$rua[$i+1]
that will tell whether index exists or not– rray
Habito, could have used only Count even.
– KevinF
Go on until you get a wrong result :P
– rray