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); $a = array($o1, $o2, $o3); foreach($a as $o){ sort($o->distance); } var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: sort(): Argument #1 ($array) must be of type array, float given in /in/DLjVg:22 Stack trace: #0 /in/DLjVg(22): sort(1500.0) #1 {main} thrown in /in/DLjVg on line 22
Process exited with code 255.

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:
49.53 ms | 401 KiB | 8 Q