3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_COUNT = 1000000; // 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(): %.5f seconds\n", $finish - $start); // 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(): %.5f 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.1000.29266.36
7.3.00.1270.28666.18
7.2.130.0860.26250.36
7.2.120.0270.00411.73
7.2.110.1480.28966.25
7.2.100.1190.30466.57
7.2.90.1460.30566.49
7.2.80.1180.30166.40
7.2.70.0360.00615.99
7.2.60.0300.00713.66
7.2.50.1450.31466.82
7.2.40.0430.00011.99
7.2.30.1190.32666.75
7.2.20.1820.32866.53
7.2.10.1630.31366.82
7.2.00.0720.29968.02
7.1.250.1110.46165.53
7.1.70.0100.38167.01
7.1.60.0270.38367.23
7.1.50.1890.34166.69
7.1.00.0170.42772.25
7.0.200.0830.32666.66
7.0.140.0130.38771.80
7.0.100.1170.36767.54
7.0.90.1330.41067.40
7.0.80.1570.38367.43
7.0.70.1500.38767.66
7.0.60.1330.32767.47
7.0.50.1770.30067.88
7.0.40.1500.30066.59
7.0.30.0530.37766.69
7.0.20.1830.37366.59
7.0.10.2070.37766.67
7.0.00.1700.33766.63
5.6.280.0230.21785.79
5.6.250.0300.19385.36
5.6.240.0430.14785.16
5.6.230.0270.19385.19
5.6.220.0230.16385.26
5.6.210.0400.18385.33
5.6.200.0100.14385.72
5.6.190.0230.19385.63
5.6.180.0330.15085.81
5.6.170.0200.17785.70
5.6.160.0270.18785.60
5.6.150.0130.23385.60
5.6.140.0270.17085.57
5.6.130.0170.15085.60
5.6.120.0270.15085.69
5.6.110.0230.18785.58
5.6.100.0200.19785.65
5.6.90.0270.20385.57
5.6.80.0370.21785.05
5.6.70.0200.16085.19
5.6.60.0400.18084.97
5.6.50.0400.15084.99
5.6.40.0300.14385.01
5.6.30.0230.15085.04
5.6.20.0430.18384.95
5.6.10.0170.21085.10
5.6.00.0500.20785.09
5.5.380.0270.14385.04
5.5.370.0270.17085.10
5.5.360.0300.23385.09
5.5.350.0100.16385.10
5.5.340.0330.13785.54
5.5.330.0530.15785.54
5.5.320.0330.18385.36
5.5.310.0230.16385.44
5.5.300.0230.19785.24
5.5.290.0400.13785.41
5.5.280.0170.16385.57
5.5.270.0130.18385.40
5.5.260.0370.18385.38
5.5.250.0200.23085.09
5.5.240.0370.15084.80
5.5.230.0200.15384.77
5.5.220.0330.19384.89
5.5.210.0270.15084.88
5.5.200.0300.14784.77
5.5.190.0570.13084.82
5.5.180.0470.15384.75
5.5.160.0330.17784.89
5.5.150.0300.24784.83
5.5.140.0330.24784.88
5.5.130.0270.21784.83
5.5.120.0330.18784.91
5.5.110.0230.21084.81
5.5.100.0130.18084.80
5.5.90.0430.17384.68
5.5.80.0370.16084.70
5.5.70.0370.20384.68
5.5.60.0200.16784.77
5.5.50.0470.20384.66
5.5.40.0330.15384.73
5.5.30.0500.15784.66
5.5.20.0230.15084.79
5.5.10.0130.18084.74
5.5.00.0430.18384.58
5.4.450.0130.20383.89
5.4.440.0270.14783.90
5.4.430.0200.14783.95
5.4.420.0300.13384.05
5.4.410.0200.14383.73
5.4.400.0130.15083.58
5.4.390.0330.20383.53
5.4.380.0070.15783.49
5.4.370.0200.21383.36
5.4.360.0330.14083.63
5.4.350.0200.12083.58
5.4.340.0270.14783.57
5.4.320.0200.16383.36
5.4.310.0300.18383.72
5.4.300.0400.16083.57
5.4.290.0200.19783.44
5.4.280.0270.18783.63
5.4.270.0330.18783.54
5.4.260.0230.18083.54
5.4.250.0300.18083.62
5.4.240.0270.15783.66
5.4.230.0270.18783.62
5.4.220.0230.21083.52
5.4.210.0200.15383.54
5.4.200.0300.19783.39
5.4.190.0370.15383.53
5.4.180.0230.14783.68
5.4.170.0370.13083.68
5.4.160.0400.14383.59
5.4.150.0430.18783.52
5.4.140.0530.18080.93
5.4.130.0330.18080.89
5.4.120.0200.14780.82
5.4.110.0270.17380.85
5.4.100.0370.13781.06
5.4.90.0300.18780.98
5.4.80.0370.20081.02
5.4.70.0170.16780.86
5.4.60.0230.16780.80
5.4.50.0370.13380.80
5.4.40.0570.10780.83
5.4.30.0270.11380.96
5.4.20.0270.11780.82
5.4.10.0230.11780.91
5.4.00.0200.13080.34
5.3.290.0370.20077.85
5.3.280.0170.19377.64
5.3.270.0330.17077.65
5.3.260.0230.20777.63
5.3.250.0330.18777.79
5.3.240.0170.21077.69
5.3.230.0200.18077.77
5.3.220.0300.24077.55
5.3.210.0230.18077.75
5.3.200.0270.17077.75
5.3.190.0300.16377.59
5.3.180.0170.17777.58
5.3.170.0230.17077.70
5.3.160.0230.16077.75
5.3.150.0270.14077.59
5.3.140.0130.17377.69
5.3.130.0130.15077.53
5.3.120.0200.14077.74
5.3.110.0100.15377.73
5.3.100.0230.14377.17
5.3.90.0300.15777.04
5.3.80.0200.18377.15
5.3.70.0300.15777.12
5.3.60.0130.15077.18
5.3.50.0200.14377.02
5.3.40.0170.16377.08
5.3.30.0170.14776.98
5.3.20.0170.15376.67
5.3.10.0270.14076.78
5.3.00.0130.15076.82
5.2.170.0030.03711.21
5.2.160.0070.02010.96
5.2.150.0070.02310.99
5.2.140.0000.03011.18
5.2.130.0000.02711.04
5.2.120.0130.01311.16
5.2.110.0030.02311.09
5.2.100.0000.02711.09
5.2.90.0030.02311.09
5.2.80.0000.02711.11
5.2.70.0030.02311.09
5.2.60.0000.02710.87
5.2.50.0070.02311.02
5.2.40.0130.02010.97
5.2.30.0030.02310.89
5.2.20.0070.02010.80
5.2.10.0070.02310.78
5.2.00.0070.02010.78
5.1.60.0070.01710.78
5.1.50.0000.02310.78
5.1.40.0000.02310.78
5.1.30.0030.03710.78
5.1.20.0070.04310.78
5.1.10.0070.03310.78
5.1.00.0000.05310.78
5.0.50.0070.01710.78
5.0.40.0030.02010.78
5.0.30.0070.02710.78
5.0.20.0000.02310.78
5.0.10.0070.02710.78
5.0.00.0030.04710.78
4.4.90.0030.01010.78
4.4.80.0000.01710.78
4.4.70.0000.01310.78
4.4.60.0000.01310.78
4.4.50.0030.01310.78
4.4.40.0000.02010.78
4.4.30.0000.02010.78
4.4.20.0000.01310.78
4.4.10.0030.01310.78
4.4.00.0030.02310.78
4.3.110.0030.01310.78
4.3.100.0030.01310.78
4.3.90.0070.02010.78
4.3.80.0000.02310.78
4.3.70.0030.01710.78
4.3.60.0000.03310.78
4.3.50.0000.03010.78
4.3.40.0000.02710.78
4.3.30.0000.02310.78
4.3.20.0030.03310.78
4.3.10.0000.02010.78
4.3.00.0000.03310.78

preferences:
37.74 ms | 400 KiB | 5 Q