Have genuinely searched for a solution (I am aware similar has been asked) and tried to understand in 'English' how to think of the code.

I want to find the closest number in an array given a certain number; the code below is what i have thus far.

```
//Array of numbers
$haystack = array(1,4,67,34,12,76,6,8,45,2);

//Number which we are finding the closest
$needle = 4;

sort($haystack);

foreach($haystack as $number){
    if($number > $needle){
        $difference = array($number-$needle);
        $smallest_num = array_shift($difference);
        echo $smallest_num.", "; //Echos out 2, 4, 8, 30, 41, 63, 72,
    }
}

```