It\'s the second day I try to find a solution for this problem.
I have an array.
$datas;
$datas[0]; // 8000
$datas[1]; // 8001
$datas[2]; // 8003
$datas
You can use array_diff to find the missing value.
I create a new array with values from min of $datas to max of $datas to compare against.
The return is what is missing.
$arr = range(min($datas),max($datas));
Var_dump(min(array_diff($arr,$datas)));
https://3v4l.org/ZmLAU
Can be a one liner too:
Var_dump(min(array_diff(range(min($datas),max($datas)), $datas)));