3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_COUNT = 100000; // Fill an array with random ints $ints = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints[] = rand(0, 255); } // Sort the ints sort($ints); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints[$i]; } $finish = microtime(true); printf("Time taken with sort(): %.7f seconds\n", $finish - $start); unset($ints); // Now do it again, but this time use an asort // Fill an array with random ints $ints2 = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints2[] = rand(0, 255); } // asort the ints asort($ints2); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints2[$i]; } $finish = microtime(true); printf("Time taken with asort(): %.7f seconds\n", $finish - $start);

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)
7.3.10.0330.05024.48
7.3.00.0550.05224.44
7.2.130.0540.06424.70
7.2.120.0440.05424.39
7.2.110.0250.06724.74
7.2.100.0380.05824.66
7.2.90.0300.06524.68
7.2.80.0540.06824.82
7.2.70.0570.05724.57
7.2.60.0450.07924.79
7.2.50.0440.05924.63
7.2.40.0480.06924.50
7.2.30.0510.06124.95
7.2.20.0250.06525.04
7.2.10.0550.05425.02
7.2.00.0240.06325.94
7.1.250.0240.09523.17
7.1.70.0030.06425.07
7.1.60.0070.10925.00
7.1.50.0070.10024.99
7.1.00.0030.15030.36
7.0.200.0230.06324.88
7.0.140.0070.13330.00
7.0.80.2870.11727.06
7.0.70.3070.13026.87
7.0.60.3030.09326.95
7.0.50.2400.07327.24
7.0.40.2430.08025.91
7.0.30.2170.12026.03
7.0.20.2170.09325.80
7.0.10.2370.09325.94
7.0.00.2400.09325.98
5.6.280.0100.29336.08
5.6.230.0170.25035.46
5.6.220.0200.27036.25
5.6.210.0100.27735.41
5.6.200.0170.19036.09
5.6.190.0070.23735.94
5.6.180.0170.20335.94
5.6.170.0070.24336.15
5.6.160.0000.24035.93
5.6.150.0170.26036.01
5.6.140.0130.28736.11
5.6.130.0230.28736.08
5.6.120.0170.21336.00
5.6.110.0130.27335.97
5.6.100.0030.27735.95
5.6.90.0030.29335.96
5.6.80.0100.28335.45
5.6.70.0070.28035.36
5.6.60.0230.24735.20
5.6.50.0170.21036.05
5.6.40.0130.26335.38
5.6.30.0100.25335.27
5.6.20.0270.23735.25
5.6.10.0170.23035.29
5.6.00.0130.26335.27
5.5.370.0100.26035.32
5.5.360.0130.28035.47
5.5.350.0070.28335.33
5.5.340.0130.20335.72
5.5.330.0130.26335.82
5.5.320.0130.23335.84
5.5.310.0070.25035.77
5.5.300.0170.27035.87
5.5.290.0170.22035.76
5.5.280.0200.29035.83
5.5.270.0070.29735.74
5.5.260.0130.26735.83
5.5.250.0230.26335.64
5.5.240.0070.28335.25
5.5.230.0270.26035.25
5.5.220.0130.29335.23
5.5.210.0330.26035.21
5.5.200.0070.26735.12
5.5.190.0430.28735.08
5.5.180.0030.28335.19
5.5.160.0170.26735.21
5.5.150.0200.27335.14
5.5.140.0130.26035.23
5.5.130.0130.27335.12
5.5.120.0100.24335.24
5.5.110.0230.28735.24
5.5.100.0200.29335.07
5.5.90.0170.21335.08
5.5.80.0230.28035.02
5.5.70.0170.23035.11
5.5.60.0130.27035.05
5.5.50.0100.29035.04
5.5.40.0200.27735.11
5.5.30.0070.25034.92
5.5.20.0300.27334.93
5.5.10.0130.28034.96
5.5.00.0170.30034.92
5.4.450.0200.26334.19
5.4.440.0130.29334.23
5.4.430.0200.24734.20
5.4.420.0170.27034.12
5.4.410.0170.29034.06
5.4.400.0170.24733.87
5.4.390.0230.25033.56
5.4.380.0270.24033.88
5.4.370.0070.22033.86
5.4.360.0200.25333.84
5.4.350.0100.26033.91
5.4.340.0130.22034.02
5.4.320.0170.24033.96
5.4.310.0230.22734.39
5.4.300.0230.26033.87
5.4.290.0030.23033.91
5.4.280.0170.24333.95
5.4.270.0170.25033.86
5.4.260.0130.26333.69
5.4.250.0200.28033.99
5.4.240.0300.26333.87
5.4.230.0030.23334.05
5.4.220.0100.25333.94
5.4.210.0200.26034.02
5.4.200.0100.27733.87
5.4.190.0230.27733.72
5.4.180.0100.28034.05
5.4.170.0030.30033.90
5.4.160.0100.26333.68
5.4.150.0130.22333.71
5.4.140.0100.21031.27
5.4.130.0070.21731.23
5.4.120.0130.23331.02
5.4.110.0030.21031.31
5.4.100.0330.27331.39
5.4.90.0170.28331.31
5.4.80.0230.29331.29
5.4.70.0070.26331.17
5.4.60.0200.21331.32
5.4.50.0100.21731.73
5.4.40.0070.30731.16
5.4.30.0230.27331.64
5.4.20.0130.29031.26
5.4.10.0870.24031.36
5.4.00.0270.28030.61
5.3.290.0100.22329.32
5.3.280.0130.27329.09
5.3.270.0770.24729.26
5.3.260.0230.26729.28
5.3.250.0030.25029.89
5.3.240.0130.24329.28
5.3.230.0070.28329.29
5.3.220.0070.26729.21
5.3.210.0100.20729.24
5.3.200.0070.26029.06
5.3.190.0070.29029.17
5.3.180.0500.23729.23
5.3.170.0130.27329.12
5.3.160.0100.28029.06
5.3.150.0230.25329.16
5.3.140.0100.28029.21
5.3.130.0070.23329.19
5.3.120.0130.28729.20
5.3.110.0200.29029.07
5.3.100.0170.30028.63
5.3.90.0100.30028.66
5.3.80.0170.23028.71
5.3.70.0170.27728.66
5.3.60.0200.25728.67
5.3.50.0170.24728.57
5.3.40.0230.28028.54
5.3.30.0070.29028.54
5.3.20.0170.29728.32
5.3.10.0030.22328.27
5.3.00.0170.26728.16
5.2.170.0000.04011.65
5.2.160.0070.04711.65
5.2.150.0070.06011.65
5.2.140.0000.06311.65
5.2.130.0000.06711.65
5.2.120.0000.03711.65
5.2.110.0100.05711.65
5.2.100.0000.03011.65
5.2.90.0070.06011.65
5.2.80.0070.06011.65
5.2.70.0070.03311.65
5.2.60.0030.03011.65
5.2.50.0030.06311.65
5.2.40.0100.04011.65
5.2.30.0070.06311.65
5.2.20.0000.04011.65
5.2.10.0070.05311.65
5.2.00.0030.06011.65
5.1.60.0130.03011.65
5.1.50.0000.03711.65
5.1.40.0030.03311.65
5.1.30.0070.05011.65
5.1.20.0030.04311.65
5.1.10.0130.04711.65
5.1.00.0070.05311.65
5.0.50.0000.05011.65
5.0.40.0000.02311.65
5.0.30.0030.06711.65
5.0.20.0070.02011.65
5.0.10.0030.04311.65
5.0.00.0070.04711.65
4.4.90.0000.02011.65
4.4.80.0000.02011.65
4.4.70.0030.03711.65
4.4.60.0070.03311.65
4.4.50.0030.01711.65
4.4.40.0030.05311.65
4.4.30.0070.02311.65
4.4.20.0030.03311.65
4.4.10.0030.03711.65
4.4.00.0030.02711.65
4.3.110.0130.02711.65
4.3.100.0000.03011.65
4.3.90.0070.03011.65
4.3.80.0030.05311.65
4.3.70.0030.02711.65
4.3.60.0030.01711.65
4.3.50.0000.03711.65
4.3.40.0030.05311.65
4.3.30.0000.03711.65
4.3.20.0000.02311.65
4.3.10.0070.02711.65
4.3.00.0030.02311.65

preferences:
34.75 ms | 401 KiB | 5 Q