I am trying to find missing in array.
with this code
<?php
$no = array(1,2,3,5,6,7);
$max=max($no);
for($x=0; $x<=$max; $x++){
if(!in_array($x,$no)){
$id = $x;
}else{
$id = $x+1;
}
}
echo '<pre>'; print_r($id);
?>
but the result is
8
someone can help me?