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); $array = array($o1, $o2, $o3); function quickSort( &$array ) { $cur = 1; $stack[1]['l'] = 0; $stack[1]['r'] = count($array)-1; do { $l = $stack[$cur]['l']; $r = $stack[$cur]['r']; $cur--; do { $i = $l; $j = $r; $tmp = $array[(int)( ($l+$r)/2 )]; // partion the array in two parts. // left from $tmp are with smaller values, // right from $tmp are with bigger ones do { while( $array[$i]->distance < $tmp->distance ) $i++; while( $tmp->distance < $array[$j]->distance ) $j--; // swap elements from the two sides if( $i <= $j) { $w = $array[$i]; $array[$i] = $array[$j]; $array[$j] = $w; $i++; $j--; } }while( $i <= $j ); if( $i < $r ) { $cur++; $stack[$cur]['l'] = $i; $stack[$cur]['r'] = $r; } $r = $j; }while( $l < $r ); }while( $cur != 0 ); } var_dump(QuickSort($array);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.340.0020.03812.04
5.4.320.0050.03812.54
5.4.310.0050.04012.54
5.4.300.0030.04012.54
5.4.290.0070.03612.53
5.4.280.0030.03712.43
5.4.270.0050.03712.43
5.4.260.0040.04012.43
5.4.250.0070.03512.43
5.4.240.0070.03512.43
5.4.230.0070.04012.42
5.4.220.0060.03812.42
5.4.210.0110.03212.42
5.4.200.0070.03612.42
5.4.190.0040.03812.42
5.4.180.0090.03312.41
5.4.170.0090.03412.42
5.4.160.0100.03512.41
5.4.150.0080.03712.41
5.4.140.0120.03912.10
5.4.130.0080.03512.09
5.4.120.0030.03912.05
5.4.110.0050.03712.05
5.4.100.0060.03512.04
5.4.90.0060.03712.05
5.4.80.0070.03612.05
5.4.70.0080.03212.04
5.4.60.0040.03612.04
5.4.50.0030.03912.04
5.4.40.0060.03512.02
5.4.30.0030.03812.02
5.4.20.0060.03412.02
5.4.10.0060.03412.02
5.4.00.0050.03711.52
5.3.290.0060.04212.80
5.3.280.0050.03912.71
5.3.270.0050.04412.73
5.3.260.0090.04512.72
5.3.250.0070.04012.72
5.3.240.0060.03712.72
5.3.230.0070.03612.71
5.3.220.0030.04012.68
5.3.210.0070.04412.68
5.3.200.0080.04812.68
5.3.190.0080.03512.67
5.3.180.0080.04012.68
5.3.170.0070.03512.67
5.3.160.0060.04212.68
5.3.150.0050.03812.67
5.3.140.0100.04012.66
5.3.130.0080.04312.66
5.3.120.0060.03912.66
5.3.110.0060.04112.65
5.3.100.0050.03912.14
5.3.90.0060.03612.12
5.3.80.0050.03912.11
5.3.70.0080.03712.11
5.3.60.0030.04512.10
5.3.50.0040.04112.05
5.3.40.0080.04112.05
5.3.30.0060.04212.00
5.3.20.0040.04211.79
5.3.10.0100.04611.75
5.3.00.0080.03511.73
5.2.170.0040.0319.24
5.2.160.0040.0329.23
5.2.150.0060.0319.23
5.2.140.0050.0339.23
5.2.130.0070.0379.19
5.2.120.0040.0299.20
5.2.110.0050.0289.20
5.2.100.0050.0289.20
5.2.90.0070.0299.20
5.2.80.0050.0299.19
5.2.70.0050.0309.19
5.2.60.0020.0329.15
5.2.50.0020.0329.11
5.2.40.0020.0319.09
5.2.30.0070.0279.07
5.2.20.0050.0289.06
5.2.10.0070.0298.96
5.2.00.0030.0308.82
5.1.60.0070.0228.12
5.1.50.0050.0238.11
5.1.40.0030.0258.09
5.1.30.0070.0238.43
5.1.20.0060.0248.46
5.1.10.0030.0278.19
5.1.00.0050.0248.19
5.0.50.0030.0216.67
5.0.40.0020.0206.54
5.0.30.0040.0406.34
5.0.20.0050.0266.33
5.0.10.0070.0236.31
5.0.00.0030.0356.30
4.4.90.0030.0184.77
4.4.80.0040.0174.75
4.4.70.0030.0294.75
4.4.60.0030.0164.75
4.4.50.0060.0134.77
4.4.40.0040.0254.71
4.4.30.0030.0154.76
4.4.20.0050.0194.84
4.4.10.0020.0164.85
4.4.00.0020.0264.76
4.3.110.0020.0164.67
4.3.100.0020.0154.66
4.3.90.0040.0124.63
4.3.80.0020.0254.59
4.3.70.0030.0144.63
4.3.60.0020.0174.62
4.3.50.0020.0154.63
4.3.40.0010.0264.54
4.3.30.0040.0143.30
4.3.20.0020.0163.28
4.3.10.0020.0153.24
4.3.00.0100.0236.78

preferences:
158.52 ms | 1394 KiB | 7 Q