Basically all you need to do is just keep track of the '1's, if any '0's are met, reset the 1-counter
Below will look for onsecutive 1's
$a = array(1,0,1,0,1,0,0,1,1);
$error = false;
$found = 0; //keep track with counter
$count = count($a);
for($i=0;$i<$count;$i++){
if($a[$i] === 1){
$found++;
}else{
$found = 0;
}
if($found == 2){
$error = true;
break;
}
}
if($error){
echo 'Duplicate "1" found at:'. $i;
}
You could also treat the array as a stack using array_pop() / array_shift() functions
If you are looking for any consecutive values then just compare the previous and current array values.