fix a php script - find nearest location from external array [

Job ID: 33065981

Budget: £10 – £20 GBP

as per the guide here
https://www.intelliwolf.com/find-nearest-location-from-array-of-coordinates-php/

I am trying to write a version which finds the nearest "ID" from the JSON feed found at https://easytide.admiralty.co.uk/Home/GetStations

So far I have constructed the following sandbox
https://3v4l.org/XJmNa#v7.3.0

I would like to fix the code in order to work as per the example.
search the array found at https://easytide.admiralty.co.uk/Home/GetStations
find the nearest location based on the lat/long provided and print the "properties=>ID" from the corresponding array.

I think this will be a really quick job, but I have poured over it for too many hours.
I intend to use this example code to create a service for a garmin watch widget

I want to create this myself as a learning project but am stuck on this element.
Related categories: PHP Core PHP