3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON [ [ 51.11041991029261, -2.274169921875 ], [ 51.08282186160978, -3.460693359375 ], [ 50.443513052458044, -3.570556640625 ], [ 50.443513052458044, -1.966552734375 ] ] JSON; $coords = json_decode($json, true); $lats = array_map(function (array $coord) { return $coord[0]; }, $coords); $lons = array_map(function (array $coord) { return $coord[1]; }, $coords); var_dump($lats, $lons);

preferences:
40.59 ms | 402 KiB | 5 Q