A more simple way to get the missing number(s) from the sequence, the way I see it:
<?php
$sequence = array(3, 5, 9, 11, 13);
$numbers = array(7, 9, 15);
$single_nr = 7;
function getMissingNumber(array $sequence, $single_nr = null, $numbers = array())
{
// Check if it exists in the sequence array
// check single number
if($single_nr)
{
if(!in_array($single_nr, $sequence))
{
echo $single_nr . " is not in array" . "<br />";
}
}
// check an array of numbers
if($numbers)
{
foreach($numbers as $nr)
{
if(!in_array($nr, $sequence))
{
echo $nr . " is not in array" . "<br />";
}
}
}
}
echo getMissingNumber($sequence, null, $numbers);
?>