I have created the following array in PHP with help of the Google Distance Matrix API.
Now I need to compare the [distance
] field, get the lowest value and save the key of the array in a variable. How do I do this?
I looked at min()
but this doesn't seem to work with multiple arrays.
Array
(
[utrecht_cs] => Array
(
[name] => utrecht_cs
[address] => 3511 AX Utrecht, Netherlands
[distance] => 95
)
[groningen_cs] => Array
(
[name] => groningen_cs
[address] => 9726 AC Groningen, Netherlands
[distance] => 102.47
)
[zwolle_cs] => Array
(
[name] => zwolle_cs
[address] => 8011 CW Zwolle, Netherlands
[distance] => 2.54
)
)