3v4l.org

run code in 300+ PHP versions simultaneously
<?php $location = []; $location[0] = []; $location[0]['name'] = 'Valencia'; $location[0]['latitude'] = 39.46990750; $location[0]['longitude'] = -0.37628810; $location[1] = []; $location[1]['name'] = 'Alanya'; $location[1]['latitude'] = 36.54444300; $location[1]['longitude'] = 31.99540800; $location[2] = []; $location[2]['name'] = 'Side'; $location[2]['latitude'] = 36.77687300; $location[2]['longitude'] = 31.39764400; $location[3] = []; $location[3]['name'] = 'Miami'; $location[3]['latitude'] = 25.79065400; $location[3]['longitude'] = -80.13004550; $location[4] = []; $location[4]['name'] = 'Albufeira'; $location[4]['latitude'] = 37.08907190; $location[4]['longitude'] = -8.24787960; Foreach($location as &$loc){ $loc["calc"] = $loc["latitude"] - $loc["longitude"]; } $sorted = $calc = array_column($location, "calc"); Sort($sorted); $key = array_search($sorted[round((count($sorted)-1)/2,0)], $calc); $median = $location[$key]; Var_dump($median);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { ["name"]=> string(8) "Valencia" ["latitude"]=> float(39.4699075) ["longitude"]=> float(-0.3762881) ["calc"]=> float(39.8461956) }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
232.07 ms | 405 KiB | 5 Q