3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GeoCoder { protected $latitude; protected $longitude; public $distance; public function __construct($lat,$long,$dist) { $this->latitude = $lat; $this->longitude = $long; $this->distance = $dist; } } $o1 = new GeoCoder(-22.43,-46.81,1500.00); $o2 = new GeoCoder(-22.42,-46.82,1740.00); $o3 = new GeoCoder(-21.43,-46.80,152.00); $nu = null; if ($o1->distance > $o2->distance) { $nu[] = $o2; $nu[] = $o1; } else { $nu[] = $o1; $nu[] = $o2; } if ($o2->distance > $o3->distance) { $nu[] = $o3; $nu[] = $o2; } else { $nu[] = $o2; $nu[] = $o3; } var_dump($nu);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> object(GeoCoder)#1 (3) { ["latitude":protected]=> float(-22.43) ["longitude":protected]=> float(-46.81) ["distance"]=> float(1500) } [1]=> object(GeoCoder)#2 (3) { ["latitude":protected]=> float(-22.42) ["longitude":protected]=> float(-46.82) ["distance"]=> float(1740) } [2]=> object(GeoCoder)#3 (3) { ["latitude":protected]=> float(-21.43) ["longitude":protected]=> float(-46.8) ["distance"]=> float(152) } [3]=> object(GeoCoder)#2 (3) { ["latitude":protected]=> float(-22.42) ["longitude":protected]=> float(-46.82) ["distance"]=> float(1740) } }

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:
47.44 ms | 402 KiB | 8 Q