If you know or you can reconstruct the original array (1,2,3,4,5), then you can use [man]array_diff[/man] to get an array of all the values that are missing from the new array.
$original_array = array(1,2,3,4,5);
$new_array = array(1,2,4,5);
print_r(array_diff($original_array, $new_array));
//output Array([0]=>3)
And of course if that array is empty, that's when you know to insert a 6.