3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tstart = microtime(true); $numberOfRandoms = 50000; $uniques = array(); do { $uniques[mt_rand(10000, 99999)] = true; } while(count(array_keys($uniques)) < $numberOfRandoms); $uniques = array_keys($uniques); $elapsed = microtime(true) - $tstart; echo "hek2mgl:\t\t\t" . $elapsed . PHP_EOL; $tstart = microtime(true); $uniques = range(10000, 99999); shuffle($uniques); $uniques = array_slice($uniques, 0, 500); $elapsed = microtime(true) - $tstart; echo "Dave Chen:\t\t\t" . $elapsed . PHP_EOL; $tstart = microtime(true); $uniques = array(); for($i = 0; $i < 500; $i++) { do { $code = mt_rand(10000, 99999); } while(in_array($code, $uniques)); $uniques[] = $code; } $elapsed = microtime(true) - $tstart; echo "Josh from Qaribou:\t\t" . $elapsed . PHP_EOL;

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.1.70.0072.49418.85
7.1.60.0072.49519.33
7.1.50.0302.47336.95
7.1.00.0032.49724.18
7.0.200.0432.45617.71
7.0.140.0102.49024.00
7.0.60.0102.49022.06
7.0.50.0102.49019.81
7.0.40.0102.49019.65
7.0.30.0272.47319.95
7.0.20.0232.47719.75
7.0.10.0172.48319.93
7.0.00.0032.49719.83
5.6.280.2002.30023.30
5.6.210.2732.22722.81
5.6.200.2532.24720.45
5.6.190.6331.86022.06
5.6.180.0072.49323.04
5.6.170.3232.17722.54
5.6.160.2772.22322.54
5.6.150.2372.26320.25
5.6.140.2172.28320.22
5.6.130.2702.23020.50
5.6.120.2472.25323.18
5.6.110.2472.25323.27
5.6.100.2802.22023.22
5.6.90.2602.24023.16
5.6.80.2132.28722.70
5.5.350.2632.20022.24
5.5.340.1832.22722.59
5.5.330.2202.22022.62
5.5.320.2132.24022.55
5.5.310.1902.27322.54
5.5.300.2402.23322.58
5.5.290.1902.23322.65
5.5.280.1572.27022.61
5.5.270.1772.20022.57
5.5.260.2502.21722.56
5.5.250.1702.29022.39
5.5.240.1602.27722.07
5.4.450.2172.22320.80
5.4.440.1872.26021.05
5.4.430.2372.21321.01
5.4.420.1932.25721.06
5.4.410.2032.25020.86
5.4.400.1672.25320.66
5.4.390.1602.26020.66
5.4.380.2202.19320.77
5.4.370.1932.22320.66
5.4.360.2032.21320.48
5.4.350.0402.36020.84
5.4.340.1572.26320.48
5.4.320.1912.05117.58
5.4.310.1811.94417.53
5.4.300.1591.85617.45
5.4.290.1561.86817.56
5.4.280.1151.92617.19
5.4.270.1471.91517.40
5.4.260.1171.89417.32
5.4.250.1241.98917.32
5.4.240.1481.95017.35
5.4.230.1411.85217.28
5.4.220.1631.85417.41
5.4.210.1421.91717.40
5.4.200.1601.89317.32
5.4.190.1531.85717.23
5.4.180.0192.17117.44
5.4.170.1552.09817.29
5.4.160.1652.10317.23
5.4.150.1712.08217.36
5.4.140.1522.08715.87
5.4.130.1832.04816.01
5.4.120.1372.09015.68
5.4.110.1512.10515.72
5.4.100.1962.04015.83
5.4.90.1902.02615.76
5.4.80.1422.00115.84
5.4.70.1702.07715.95
5.4.60.1882.05116.06
5.4.50.1432.11215.71
5.4.40.1732.17915.64
5.4.30.1522.17315.73
5.4.20.1902.09115.89
5.4.10.1802.14015.82
5.4.00.1842.12415.18
5.3.290.2082.00115.39
5.3.280.1542.02014.99
5.3.270.1292.22615.13
5.3.260.1732.15615.22
5.3.250.1102.20914.95
5.3.240.1192.19015.02
5.3.230.1262.07015.08
5.3.220.1642.03915.07
5.3.210.1632.07115.13
5.3.200.1922.09715.11
5.3.190.1622.06015.01
5.3.180.1722.03015.20
5.3.170.1342.10515.17
5.3.160.1602.10115.25
5.3.150.1732.06215.24
5.3.140.1722.09115.07
5.3.130.1792.08415.06
5.3.120.0812.15415.30
5.3.110.1772.04815.21
5.3.100.1862.05314.57
5.3.90.0992.14014.78
5.3.80.1672.06014.68
5.3.70.1562.07714.70

preferences:
38.23 ms | 401 KiB | 5 Q