I am a newbie in PHP. I have been given the following as homework: Write a php function called findMissing that receives 3 parameters. The function must determine and return a missing number in an array of numbers – note: only one number will be missing from the series of numbers, the number you must find. All the numbers will be integers. ◦ $start : This will be an integer indicating the minimum number the array can contain. ◦ $end : This will be an integer indicating the maximum number the array can contain. ◦ $numbers : An array with numbers between $start and $end. This array might not be sorted. There is no guarantee that the first or last number in the array will correspond to $start and $end respectively. $start and $end are inclusive in the range of numbers As an example: findMissing(1, 5, array(2,5,1,3)); must return 4 as the missing number. The array $numbers will always contain $end - $start number of elements.
So far I have the following code:
function findMissing($start,$end,$numbers)
{
if ($start >0 && $end >0){
for ($x=0; $x<=end; $x++) {
$numbers=array($x);
}
}
foreach ($numbers as $value){
echo $value;
}
}
Please help because I am stuck