3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tstart = microtime(true); $numberOfRandoms = 500; $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.2.00.0100.01023.11
7.1.70.0530.00719.63
7.1.60.0530.01020.04
7.1.50.0450.01419.57
7.1.40.0850.01319.50
7.1.30.0520.00719.64
7.1.20.0520.01619.64
7.1.10.0590.01019.03
7.1.00.0700.01719.22
7.0.200.0540.00919.36
7.0.190.0530.00719.18
7.0.180.0450.01019.11
7.0.170.0420.01118.71
7.0.160.0470.00718.84
7.0.150.0510.01018.73
7.0.140.0480.01318.79
7.0.130.0490.01019.21
7.0.120.0590.00419.05
7.0.110.0500.00719.19
7.0.100.0620.00918.80
7.0.90.0470.01318.93
7.0.80.0480.01019.01
7.0.70.1270.01018.49
7.0.60.1790.00720.34
7.0.50.1350.01320.53
7.0.40.0130.00418.74
7.0.30.0050.01018.53
7.0.20.0110.00418.50
7.0.10.0070.01018.56
7.0.00.0150.00718.54
5.6.300.0210.08434.21
5.6.290.0000.09734.26
5.6.280.0070.08134.12
5.6.270.0270.06734.31
5.6.260.0070.08834.43
5.6.250.0160.07434.21
5.6.240.0100.08434.22
5.6.230.0140.06834.31
5.6.220.0070.10034.16
5.6.210.0200.07034.36
5.6.200.0210.07134.11
5.6.190.0100.08534.27
5.6.180.0170.07734.38
5.6.170.0130.07834.26
5.6.160.0160.08934.03
5.6.150.0070.08034.13
5.6.140.0030.10634.32
5.6.130.0140.07534.16
5.6.120.0030.10234.15
5.6.110.0100.13334.09
5.6.100.0230.07034.14
5.6.90.0070.08734.14
5.6.80.0120.10033.65
5.6.70.0140.07833.44
5.6.60.0120.07333.57
5.6.50.0140.07133.45
5.6.40.0070.08433.63
5.6.30.0130.08733.64
5.6.20.0120.06833.53
5.6.10.0070.08133.64
5.6.00.0160.07233.66
5.5.380.0140.07730.84
5.5.370.0030.11830.85
5.5.360.0200.08030.79
5.5.350.0520.08430.70
5.5.340.0130.08631.29
5.5.330.0100.09031.36
5.5.320.0000.09531.25
5.5.310.0000.08531.36
5.5.300.0300.07631.15
5.5.290.0130.07931.15
5.5.280.0200.10231.25
5.5.270.0100.13631.12
5.5.260.0070.08531.23
5.5.250.0060.09431.17
5.5.240.0130.07830.72
5.5.230.0130.06930.75
5.5.220.0060.08430.54
5.5.210.0160.06730.63
5.5.200.0100.07730.59
5.5.190.0160.09030.50
5.5.180.0070.07730.61
5.5.160.0360.07030.64
5.5.150.0100.07430.34
5.5.140.0100.07030.70
5.5.130.0030.08830.71
5.5.120.0060.07430.63
5.5.110.0170.07030.34
5.5.100.0000.09330.54
5.5.90.0100.07730.58
5.5.80.0000.08330.54
5.5.70.0000.08630.56
5.5.60.0130.07930.55
5.5.50.0070.08230.51
5.5.40.0030.07830.51
5.5.30.0100.06830.57
5.5.20.0070.07230.57
5.5.10.0100.07630.49
5.5.00.0070.08830.57
5.4.450.0130.08032.66
5.4.440.0030.07832.75
5.4.430.0190.11632.74
5.4.420.0170.10132.90
5.4.410.0160.07932.67
5.4.400.0130.11732.43
5.4.390.0160.06532.52
5.4.380.0160.08432.45
5.4.370.0030.08332.51
5.4.360.0160.07532.53
5.4.350.0100.08132.69
5.4.340.0490.12032.68
5.4.320.0100.07632.43
5.4.310.0030.07732.53
5.4.300.0170.07032.43
5.4.290.0270.08032.64
5.4.280.0100.08632.46
5.4.270.0100.07932.57
5.4.260.0070.08132.47
5.4.250.0100.07632.29
5.4.240.0130.07032.42
5.4.230.0000.08532.39
5.4.220.0070.07432.39
5.4.210.0130.08432.32
5.4.200.0070.07532.32
5.4.190.0270.07332.64
5.4.180.0070.08232.64
5.4.170.0310.08632.46
5.4.160.0000.08832.51
5.4.150.0100.11832.55
5.4.140.0140.06929.89
5.4.130.0070.06830.13
5.4.120.0100.08130.09
5.4.110.0140.06529.91
5.4.100.0070.07829.99
5.4.90.0070.08129.93
5.4.80.0030.09629.92
5.4.70.0070.08029.91
5.4.60.0100.07229.89
5.4.50.0030.07929.89
5.4.40.0140.06829.79
5.4.30.0060.07329.79
5.4.20.0130.06729.82
5.4.10.0070.08929.70
5.4.00.0100.08429.39
5.3.290.0130.07727.85
5.3.280.0130.07027.70
5.3.270.0030.09627.84
5.3.260.0340.08227.91
5.3.250.0030.08827.80
5.3.240.0030.08227.96
5.3.230.0070.07927.78
5.3.220.0070.07927.84
5.3.210.0310.07927.88
5.3.200.0160.09227.90
5.3.190.0070.07627.80
5.3.180.0130.09927.73
5.3.170.0100.08127.95
5.3.160.0220.07327.87
5.3.150.0300.07127.73
5.3.140.0100.11827.66
5.3.130.0100.07227.81
5.3.120.0100.07727.87
5.3.110.0300.09427.93
5.3.100.0000.07427.38
5.3.90.0130.07527.19
5.3.80.0100.07727.34
5.3.70.0070.07627.34
5.3.60.0260.08827.35
5.3.50.0070.07927.18
5.3.40.0130.07427.28
5.3.30.0070.07227.16
5.3.20.0070.09026.94
5.3.10.0070.07126.75
5.3.00.0070.08027.01
5.2.170.0160.06923.64
5.2.160.0000.08123.75
5.2.150.0030.06823.77
5.2.140.0000.07723.53
5.2.130.0060.07423.48
5.2.120.0070.07323.60
5.2.110.0060.07123.29
5.2.100.0030.07523.55
5.2.90.0000.08223.64
5.2.80.0200.05123.40
5.2.70.0000.07623.68
5.2.60.0030.08823.66
5.2.50.0100.07323.34
5.2.40.0100.09423.18
5.2.30.0030.08223.30
5.2.20.0140.06123.34
5.2.10.0100.06523.43
5.2.00.0070.06223.32
5.1.60.0100.07526.76
5.1.50.0100.08126.44
5.1.40.0030.08326.54
5.1.30.0100.07626.88
5.1.20.0070.08627.10
5.1.10.0330.08726.71
5.1.00.0030.09126.83
5.0.50.0070.08025.09
5.0.40.0070.07725.02
5.0.30.0030.08624.98
5.0.20.0130.08524.96
5.0.10.0100.08024.75
5.0.00.0030.09824.78
4.4.90.0030.08122.63
4.4.80.0030.11022.70
4.4.70.0100.06822.70
4.4.60.0030.09222.61
4.4.50.0070.07522.71
4.4.40.0100.07722.70
4.4.30.0100.06822.71
4.4.20.0030.08022.76
4.4.10.0100.07922.66
4.4.00.0070.08122.69
4.3.110.0030.08822.71
4.3.100.0000.08322.63
4.3.90.0300.06422.54
4.3.80.0270.08422.52
4.3.70.0030.08122.45
4.3.60.0030.08022.45
4.3.50.0130.06722.45
4.3.40.0060.07822.53
4.3.30.0070.07421.29
4.3.20.0070.08221.32
4.3.10.0000.08021.23
4.3.00.0030.09121.30

preferences:
28.4 ms | 401 KiB | 5 Q