3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*function sortByLength($a,$b){ return strlen($b)-strlen($a); } $array = array("bbbbb", "dog", "cat", "aaa", "aaaa"); echo usort($array,'sortByLength'); // print_r($sorted);*/ $priorities = array(5, 8, 3, 7, 3); usort($priorities, function($a, $b) { if ($a == $b) { echo "a ($a) is same priority as b ($b), keeping the same\n"; return 0; } else if ($a > $b) { echo "a ($a) is higher priority than b ($b), moving b down array\n"; return -1; } else { echo "b ($b) is higher priority than a ($a), moving b up array\n"; return 1; } }); echo "Sorted priorities:\n"; var_dump($priorities);

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.3.60.0140.00416.50
8.3.50.0090.01221.21
8.3.40.0120.00318.59
8.3.30.0120.00318.57
8.3.20.0040.00420.04
8.3.10.0030.00523.66
8.3.00.0040.00417.78
8.2.180.0070.01016.63
8.2.170.0110.00422.96
8.2.160.0100.00320.39
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00617.50
8.2.110.0070.01020.33
8.2.100.0090.00317.63
8.2.90.0030.00618.92
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0090.00018.04
8.2.50.0000.00818.07
8.2.40.0000.00821.04
8.2.30.0050.00220.57
8.2.20.0030.00617.79
8.2.10.0100.00018.04
8.2.00.0000.00818.22
8.1.280.0110.00725.92
8.1.270.0100.01023.83
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0110.00721.04
8.1.230.0060.00617.42
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00617.50
8.1.190.0040.00417.23
8.1.180.0030.00518.10
8.1.170.0040.00418.43
8.1.160.0040.00422.09
8.1.150.0060.00318.83
8.1.140.0040.00419.66
8.1.130.0040.00417.67
8.1.120.0040.00417.49
8.1.110.0050.00217.37
8.1.100.0040.00417.37
8.1.90.0050.00217.54
8.1.80.0030.00717.43
8.1.70.0020.00517.46
8.1.60.0000.00817.60
8.1.50.0080.00017.58
8.1.40.0000.00817.41
8.1.30.0040.00417.71
8.1.20.0080.00017.60
8.1.10.0000.00717.52
8.1.00.0080.00017.36
8.0.300.0000.00718.77
8.0.290.0030.00616.75
8.0.280.0080.00018.32
8.0.270.0030.00317.16
8.0.260.0000.00617.15
8.0.250.0030.00517.00
8.0.240.0000.00617.06
8.0.230.0030.00316.98
8.0.220.0000.00716.96
8.0.210.0040.00416.86
8.0.200.0040.00417.00
8.0.190.0000.00816.96
8.0.180.0000.00716.98
8.0.170.0040.00416.93
8.0.160.0000.00716.87
8.0.150.0000.00716.84
8.0.140.0070.00016.83
8.0.130.0030.00313.36
8.0.120.0040.00416.92
8.0.110.0000.00716.92
8.0.100.0000.00716.83
8.0.90.0000.00816.92
8.0.80.0000.01516.87
8.0.70.0080.00016.90
8.0.60.0000.00716.76
8.0.50.0050.00216.71
8.0.30.0050.01317.04
8.0.20.0100.00817.40
8.0.10.0050.00317.06
8.0.00.0100.00916.85
7.4.330.0000.00515.14
7.4.320.0000.00616.65
7.4.300.0030.00316.61
7.4.290.0040.00416.36
7.4.280.0070.00016.43
7.4.270.0000.00816.50
7.4.260.0000.00716.57
7.4.250.0000.00816.46
7.4.240.0000.00716.56
7.4.230.0030.00316.60
7.4.220.0090.00916.61
7.4.210.0110.00416.66
7.4.200.0000.00716.59
7.4.160.0090.00916.45
7.4.150.0040.01417.40
7.4.140.0130.00517.86
7.4.130.0140.00716.52
7.4.120.0070.00916.50
7.4.110.0170.00016.49
7.4.100.0130.01016.49
7.4.90.0090.00916.48
7.4.80.0110.00619.39
7.4.70.0110.00716.48
7.4.60.0100.01016.43
7.4.50.0000.00716.16
7.4.40.0030.01416.52
7.4.30.0060.01616.39
7.4.00.0080.00815.06
7.3.330.0050.00013.36
7.3.320.0050.00013.32
7.3.310.0040.00416.39
7.3.300.0020.00516.30
7.3.290.0050.01016.30
7.3.280.0080.01116.31
7.3.270.0190.00017.40
7.3.260.0090.00916.42
7.3.250.0100.00716.39
7.3.240.0110.01416.27
7.3.230.0170.00716.63
7.3.210.0060.01616.28
7.3.200.0040.01216.37
7.3.190.0070.01016.30
7.3.180.0040.01216.16
7.3.170.0090.00916.27
7.3.160.0140.00316.47
7.2.330.0060.01516.53
7.2.320.0100.00716.45
7.2.310.0090.00916.70
7.2.300.0090.01216.62
7.2.290.0060.01516.49
7.2.60.0030.00716.58
7.2.00.0080.01219.45
7.1.200.0070.00315.87
7.1.100.0030.01018.40
7.1.70.0040.00417.06
7.1.60.0100.01419.50
7.1.50.0090.01317.02
7.1.00.0100.07022.57
7.0.200.0320.01014.89
7.0.60.0370.06020.02
7.0.50.0070.08017.92
7.0.40.0170.07020.22
7.0.30.0230.05020.08
7.0.20.0230.04320.12
7.0.10.0130.07320.18
7.0.00.0100.08020.26
5.6.280.0030.03321.11
5.6.210.0030.08720.47
5.6.200.0070.03718.12
5.6.190.0000.04720.77
5.6.180.0200.05020.64
5.6.170.0170.05720.55
5.6.160.0130.08320.45
5.6.150.0100.06718.16
5.6.140.0000.04318.30
5.6.130.0070.06318.24
5.6.120.0100.08721.01
5.6.110.0030.08721.14
5.6.100.0100.08020.98
5.6.90.0170.06320.99
5.6.80.0130.07020.53
5.5.350.0030.08320.45
5.5.340.0030.05718.02
5.5.330.0070.08020.47
5.5.320.3530.04720.39
5.5.310.0230.03720.24
5.5.300.0170.03317.94
5.5.290.0070.05017.93
5.5.280.0100.08320.88
5.5.270.0030.04020.78
5.5.260.0130.04720.85
5.5.250.0130.07320.80
5.5.240.0000.04320.19
5.4.450.0730.05719.57
5.4.440.0930.07319.41
5.4.430.0670.06719.44
5.4.420.0670.06019.41
5.4.410.0800.05019.25
5.4.400.0700.06718.93
5.4.390.0600.06319.06
5.4.380.0770.04319.25
5.4.370.0770.05719.38
5.4.360.0570.07018.95
5.4.350.0570.06319.39
5.4.340.0730.06719.08
5.4.320.0630.07019.07
5.4.310.0730.04718.81
5.4.300.0700.05318.80
5.4.290.0700.05018.82
5.4.280.0630.06019.09
5.4.270.0730.06319.23
5.4.260.0630.06019.24
5.4.250.0770.05018.94
5.4.240.0800.06318.91
5.4.230.1200.06019.36
5.4.220.0800.05019.07
5.4.210.0730.05719.08
5.4.200.0700.05319.15
5.4.190.0770.04718.94
5.4.180.0730.05019.27
5.4.170.0700.05318.91
5.4.160.0700.05019.05
5.4.150.0770.05318.93
5.4.140.0770.05316.72
5.4.130.0770.04016.40
5.4.120.0600.06016.44
5.4.110.0730.04716.52
5.4.100.1100.06016.42
5.4.90.0770.04716.60
5.4.80.0730.04716.39
5.4.70.0330.06716.36
5.4.60.0070.08016.33
5.4.50.0030.06716.25
5.4.40.0300.03016.51
5.4.30.0230.07016.42
5.4.20.0000.04016.35

preferences:
87.49 ms | 401 KiB | 5 Q