3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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); sort($a); var_dump($a);
based on v41S0
Output for 5.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
array(3) { [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) } }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.2.17
array(3) { [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) } }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/SbuiP on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/SbuiP on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/SbuiP on line 4
Process exited with code 255.