3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare($a, $b) { // Sort by weight, unless disabled. if ($a->region != -1) { $weight = $a->weight - $b->weight; if ($weight) { return $weight; } } // Sort by label. return strcmp($a->label, $b->label); } $a = (object)['region' => 1, 'weight' => 1, 'label' => 'A']; $b = (object)['region' => -1, 'weight' => 2, 'label' => 'A']; $c = (object)['region' => 1, 'weight' => 0, 'label' => 'B']; assert(-1 === compare($a, $b)); assert(-1 === compare($b, $c)); assert(-1 === compare($c, $a));

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)
8.4.140.0080.01317.52
8.4.130.0140.00817.69
8.4.120.0110.00919.75
8.4.110.0130.00722.45
8.4.100.0090.01017.64
8.4.90.0130.00720.66
8.4.80.0140.00518.80
8.4.70.0110.00820.51
8.4.60.0100.01122.30
8.4.50.0110.00818.70
8.4.40.0060.01318.70
8.4.30.0140.00719.64
8.4.20.0130.00317.71
8.4.10.0060.00317.73
8.3.270.0110.01016.67
8.3.260.0090.01016.54
8.3.250.0080.00718.87
8.3.240.0020.00620.79
8.3.230.0070.00416.74
8.3.220.0100.00818.88
8.3.210.0090.00718.54
8.3.200.0040.00516.46
8.3.190.0090.00616.96
8.3.180.0130.00616.45
8.3.170.0070.01016.99
8.3.160.0120.00317.10
8.3.150.0150.00020.68
8.3.140.0040.01116.97
8.3.130.0050.00318.38
8.3.120.0060.00318.97
8.3.110.0040.00720.94
8.3.100.0100.01024.06
8.3.90.0120.00326.77
8.3.80.0000.00918.30
8.3.70.0130.00316.25
8.3.60.0040.01118.55
8.3.50.0100.01021.97
8.3.40.0070.00718.85
8.3.30.0040.01118.66
8.3.20.0070.00020.37
8.3.10.0000.00821.90
8.3.00.0080.00019.25
8.2.290.0080.01016.58
8.2.280.0070.00118.27
8.2.270.0060.01317.20
8.2.260.0070.01418.25
8.2.250.0030.00516.75
8.2.240.0000.01617.04
8.2.230.0000.00822.58
8.2.220.0110.00837.54
8.2.210.0080.00026.77
8.2.200.0090.00016.75
8.2.190.0080.00816.88
8.2.180.0170.00316.75
8.2.170.0140.00422.96
8.2.160.0100.00319.51
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0040.00422.08
8.2.120.0000.00726.35
8.2.110.0040.00421.00
8.2.100.0120.00417.91
8.2.90.0000.00819.05
8.2.80.0040.00417.97
8.2.70.0070.00417.63
8.2.60.0000.00817.80
8.2.50.0000.00918.10
8.2.40.0000.00720.37
8.2.30.0040.00419.26
8.2.20.0040.00417.80
8.2.10.0040.00418.05
8.2.00.0000.00717.99
8.1.330.0120.00416.41
8.1.320.0080.00616.04
8.1.310.0110.00418.30
8.1.300.0030.00618.31
8.1.290.0060.00630.84
8.1.280.0150.00025.92
8.1.270.0000.00823.85
8.1.260.0050.00228.09
8.1.250.0030.00528.09
8.1.240.0070.00420.31
8.1.230.0060.00617.77
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.10
8.1.190.0030.00617.00
8.1.180.0060.00318.10
8.1.170.0040.00418.53
8.1.160.0040.00423.95
8.1.150.0000.00718.90
8.1.140.0070.00019.65
8.1.130.0080.00017.61
8.1.120.0070.00017.48
8.1.110.0000.00817.37
8.1.100.0040.00417.36
8.1.90.0040.00417.48
8.1.80.0040.00417.49
8.1.70.0040.00417.49
8.1.60.0040.00417.61
8.1.50.0030.00517.45
8.1.40.0080.00017.55
8.1.30.0040.00417.54
8.1.20.0030.00617.56
8.1.10.0040.00417.44
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0060.00316.63
8.0.280.0030.00318.46
8.0.270.0030.00317.20
8.0.260.0030.00317.20
8.0.250.0030.00316.96
8.0.240.0000.00916.88
8.0.230.0040.00417.00
8.0.220.0030.00316.89
8.0.210.0030.00516.79
8.0.200.0030.00316.98
8.0.190.0040.00416.99
8.0.180.0040.00416.94
8.0.170.0040.00416.82
8.0.160.0040.00416.89
8.0.150.0040.00416.91
8.0.140.0000.00816.84
8.0.130.0050.00013.41
8.0.120.0050.00316.90
8.0.110.0000.00716.94
8.0.100.0030.00616.80
8.0.90.0020.00516.85
8.0.80.0050.01016.84
8.0.70.0070.00016.92
8.0.60.0040.00416.75
8.0.50.0040.00417.02
8.0.30.0100.00617.16
8.0.20.0080.01117.40
8.0.10.0040.00417.10
8.0.00.0070.01317.09
7.4.330.0000.00515.08
7.4.320.0000.00616.51
7.4.300.0000.00616.37
7.4.290.0050.00216.62
7.4.280.0040.00416.61
7.4.270.0040.00416.45
7.4.260.0040.00716.37
7.4.250.0030.00316.60
7.4.240.0040.00416.50
7.4.230.0030.00316.52
7.4.220.0110.00716.59
7.4.210.0060.01216.46
7.4.200.0040.00416.57
7.4.160.0100.00716.36
7.4.150.0090.00917.40
7.4.140.0130.00517.86
7.4.130.0090.00816.60
7.4.120.0110.00816.64
7.4.110.0100.00616.67
7.4.100.0130.01016.47
7.4.90.0030.01416.68
7.4.80.0110.01119.39
7.4.70.0100.00716.36
7.4.60.0100.00616.40
7.4.50.0070.00716.26
7.4.40.0120.00316.44
7.4.30.0140.00316.45
7.4.20.0090.00916.50
7.4.10.0130.00316.60
7.4.00.0060.01016.15
7.3.330.0060.00013.21
7.3.320.0060.00013.30
7.3.310.0030.00316.19
7.3.300.0060.00016.27
7.3.290.0060.00716.38
7.3.280.0070.01016.39
7.3.270.0000.02117.40
7.3.260.0080.01016.51
7.3.250.0070.01116.41
7.3.240.0060.01516.47
7.3.230.0140.00416.46
7.3.210.0070.01016.72
7.3.200.0120.01219.39
7.3.190.0080.01216.43
7.3.180.0070.01316.30
7.3.170.0090.00616.30
7.3.160.0150.00016.59
7.3.150.0090.00616.54
7.3.140.0030.01316.40
7.3.130.0090.00616.49
7.3.120.0060.01016.36
7.3.110.0120.00316.41
7.3.100.0120.00616.21
7.3.90.0070.01016.35
7.3.80.0080.00816.38
7.3.70.0040.01216.40
7.3.60.0060.00916.23
7.3.50.0070.01016.34
7.3.40.0070.01016.23
7.3.30.0050.01116.31
7.3.20.0060.01016.38
7.3.10.0070.01316.38
7.3.00.0130.00716.39
7.2.330.0030.01716.35
7.2.320.0100.01016.71
7.2.310.0060.01016.69
7.2.300.0080.00816.82
7.2.290.0070.01016.52
7.2.280.0080.00816.56
7.2.270.0040.01116.30
7.2.260.0040.01216.55
7.2.250.0050.01116.65
7.2.240.0060.01016.76
7.2.230.0110.00516.84
7.2.220.0120.00416.35
7.2.210.0140.00316.77
7.2.200.0030.01316.59
7.2.190.0030.01316.69
7.2.180.0090.00916.63
7.2.170.0060.01516.57
7.2.160.0100.00716.72
7.2.150.0100.00916.53
7.2.140.0100.00716.63
7.2.130.0100.00716.69
7.2.120.0070.01016.61
7.2.110.0170.00716.59
7.2.100.0040.01316.68
7.2.90.0090.00816.38
7.2.80.0040.01316.65
7.2.70.0030.01316.75
7.2.60.0150.00416.68
7.2.50.0140.00716.51
7.2.40.0100.00716.64
7.2.30.0190.00416.67
7.2.20.0100.00716.41
7.2.10.0140.00716.87
7.2.00.0140.00316.46
7.1.330.0110.00415.61
7.1.320.0000.01615.53
7.1.310.0080.00815.52
7.1.300.0030.01315.55
7.1.290.0050.01015.59
7.1.280.0100.00515.37
7.1.270.0100.00515.47
7.1.260.0100.00615.47
7.1.250.0140.00615.59
7.1.240.0120.00315.68
7.1.230.0100.00615.54
7.1.220.0100.00715.34
7.1.210.0090.00615.45
7.1.200.0060.00715.66
7.1.190.0090.00615.57
7.1.180.0090.01215.48
7.1.170.0080.00815.58
7.1.160.0060.00915.52
7.1.150.0070.01015.54
7.1.140.0060.01215.46
7.1.130.0110.01115.54
7.1.120.0120.00915.43
7.1.110.0100.00615.55
7.1.100.0070.00715.51
7.1.90.0030.01315.68
7.1.80.0030.01315.68
7.1.70.0030.01016.36
7.1.60.0030.01116.52
7.1.50.0100.00516.31
7.1.40.0090.00416.03
7.1.30.0060.00716.00
7.1.20.0070.00616.11
7.1.10.0070.00516.10
7.1.00.0050.00716.24
7.0.330.0150.00015.45
7.0.320.0070.01115.02
7.0.310.0090.00615.22
7.0.300.0070.00715.00
7.0.290.0130.00315.08
7.0.280.0080.00815.09
7.0.270.0140.00715.15
7.0.260.0100.01015.34
7.0.250.0090.00615.28
7.0.240.0060.00915.18
7.0.230.0070.00715.36
7.0.220.0080.00615.18
7.0.210.0150.00015.30
7.0.200.0050.00715.93
7.0.190.0080.00815.92
7.0.180.0070.00515.79
7.0.170.0020.01015.78
7.0.160.0080.00315.72
7.0.150.0060.00715.71
7.0.140.0060.00515.82
7.0.130.0110.00115.78
7.0.120.0070.00615.91
7.0.110.0030.00915.83
7.0.100.0030.00915.86
7.0.90.0110.00415.78
7.0.80.0110.00215.79
7.0.70.0100.00315.85
7.0.60.0110.00115.77
7.0.50.0100.00316.03
7.0.40.0040.00915.07
7.0.30.0080.00515.07
7.0.20.0100.00415.14
7.0.10.0050.01015.15
7.0.00.0080.00515.16
5.6.400.0030.01415.93
5.6.390.0120.00915.80
5.6.380.0120.00616.02
5.6.370.0060.01216.04
5.6.360.0070.01015.77
5.6.350.0080.01615.71
5.6.340.0030.01516.22
5.6.330.0110.01415.52
5.6.320.0030.01415.98
5.6.310.0060.01216.03
5.6.300.0060.02618.17
5.6.290.0070.02418.36
5.6.280.0090.02518.54
5.6.270.0050.02718.50
5.6.260.0040.02818.34
5.6.250.0070.02418.32
5.6.240.0070.03118.51
5.6.230.0090.02118.30
5.6.220.0060.03118.39
5.6.210.0130.02418.21
5.6.200.0100.02718.38
5.6.190.0110.02418.35
5.6.180.0090.02418.32
5.6.170.0090.02618.32
5.6.160.0030.03118.24
5.6.150.0050.03218.35
5.6.140.0140.02018.43
5.6.130.0060.02918.43
5.6.120.0070.03318.38
5.6.110.0110.02318.31
5.6.100.0090.02418.48
5.6.90.0080.03218.33
5.6.80.0050.02718.00
5.6.70.0080.02518.17
5.6.60.0080.02517.97
5.6.50.0050.04417.98
5.6.40.0120.02317.94
5.6.30.0050.02917.96
5.6.20.0070.02518.07
5.6.10.0060.03118.04
5.6.00.0110.02218.01
5.5.380.0100.02716.70
5.5.370.0030.02916.69
5.5.360.0050.02716.59
5.5.350.0030.02916.73
5.5.340.0070.02516.93
5.5.330.0120.02316.92
5.5.320.0060.02616.93
5.5.310.0060.03316.83
5.5.300.0020.03316.90
5.5.290.0080.02216.92
5.5.280.0030.03316.81
5.5.270.0050.03216.74
5.5.260.0080.02316.99
5.5.250.0060.02616.76
5.5.240.0050.02816.61
5.5.230.0030.03116.69
5.5.220.0080.02816.43
5.5.210.0090.02516.52
5.5.200.0070.03116.62
5.5.190.0060.02916.48
5.5.180.0090.02116.64
5.5.170.0060.01115.62
5.5.160.0050.02516.47
5.5.150.0050.02616.50
5.5.140.0080.02416.67
5.5.130.0020.02716.63
5.5.120.0020.04716.64
5.5.110.0050.03716.52
5.5.100.0020.03016.42
5.5.90.0080.02116.46
5.5.80.0080.02316.43
5.5.70.0030.02816.52
5.5.60.0070.02316.54
5.5.50.0040.03516.50
5.5.40.0090.02916.41
5.5.30.0060.02716.58
5.5.20.0050.03216.48
5.5.10.0030.03116.48
5.5.00.0040.02616.42

preferences:
31.51 ms | 403 KiB | 5 Q