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\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.4.00.0100.01617.59
7.3.120.0040.02517.35
7.3.110.0130.01317.57
7.3.100.0100.01317.58
7.3.90.0090.01317.58
7.3.80.0110.01117.38
7.3.70.0070.01417.23
7.3.60.0100.01017.18
7.3.50.0070.01717.35
7.3.40.0030.01717.45
7.3.30.0160.00317.38
7.3.20.0070.01420.53
7.3.10.0160.01320.48
7.3.00.0150.01420.28
7.2.250.0030.02617.66
7.2.240.0130.01617.74
7.2.230.0170.01017.50
7.2.220.0070.01417.81
7.2.210.0110.01417.69
7.2.200.0120.00917.70
7.2.190.0070.01717.57
7.2.180.0060.01617.57
7.2.170.0070.01117.54
7.2.130.0320.01320.63
7.2.120.0240.02120.90
7.2.110.0230.01620.56
7.2.100.0320.01120.73
7.2.90.0280.01420.71
7.2.80.0350.00620.71
7.2.70.0220.01820.23
7.2.60.0290.01120.63
7.2.50.0280.01520.98
7.2.40.0270.02020.59
7.2.30.0320.01120.44
7.2.20.0200.01620.19
7.2.10.0220.01620.82
7.2.00.0330.01520.79
7.1.330.0070.01319.75
7.1.320.0000.02719.76
7.1.310.0070.01419.75
7.1.300.0000.02019.81
7.1.290.0060.01220.01
7.1.280.0030.01419.93
7.1.270.0120.00919.46
7.1.260.0060.01319.90
7.1.250.0270.01319.43
7.1.70.0030.00921.03
7.1.60.0080.00621.15
7.1.50.0150.01520.82
7.1.00.0030.08326.22
7.0.200.0030.01520.88
7.0.140.0000.08326.22
7.0.110.0030.08322.72
7.0.100.0030.08322.60
7.0.90.0070.09022.68
7.0.80.0100.07722.61
7.0.70.0070.06322.53
7.0.60.0070.08722.65
7.0.50.1770.08022.88
7.0.40.0930.08322.86
7.0.30.1100.08322.77
7.0.20.1300.07322.85
7.0.10.1270.07022.84
7.0.00.1170.09322.53
5.6.280.0030.14734.44
5.6.250.0270.10334.07
5.6.240.0200.11734.03
5.6.230.0000.14034.00
5.6.220.0170.13033.99
5.6.210.0030.14034.02
5.6.200.0330.09034.54
5.6.190.0170.13334.45
5.6.180.0100.12034.42
5.6.170.0130.12034.59
5.6.160.0200.11034.46
5.6.150.0230.11734.39
5.6.140.0130.10034.73
5.6.130.0130.12334.41
5.6.120.0170.11734.33
5.6.110.0030.13334.55
5.6.100.0100.11734.54
5.6.90.0100.12734.35
5.6.80.0130.11333.87
5.6.70.0130.11333.86
5.6.60.0030.13333.79
5.6.50.0130.08733.94
5.6.40.0170.11033.75
5.6.30.0130.13733.84
5.6.20.0130.13033.83
5.6.10.0130.10333.78
5.6.00.0100.13333.61
5.5.380.0030.13733.91
5.5.370.0300.07733.91
5.5.360.0070.13333.89
5.5.350.0170.12333.82
5.5.340.0170.12034.32
5.5.330.0100.11734.29
5.5.320.0100.12734.32
5.5.310.0070.10034.31
5.5.300.0200.12334.29
5.5.290.0130.12334.15
5.5.280.0300.13734.31
5.5.270.0200.11734.28
5.5.260.0130.12334.17
5.5.250.0170.13333.96
5.5.240.0230.12333.54
5.5.230.0070.12333.62
5.5.220.0100.13733.59
5.5.210.0170.11733.53
5.5.200.0200.12033.66
5.5.190.0170.11033.45
5.5.180.0230.12033.60
5.5.160.0200.09733.47
5.5.150.0130.12033.52
5.5.140.0100.12733.43
5.5.130.0100.11333.63
5.5.120.0100.11733.59
5.5.110.0170.11333.58
5.5.100.0030.12333.62
5.5.90.0230.12033.57
5.5.80.0100.09333.41
5.5.70.0070.08333.47
5.5.60.0100.06333.54
5.5.50.0130.07333.55
5.5.40.0130.09733.32
5.5.30.0130.12033.36
5.5.20.0100.11033.59
5.5.10.0100.07733.35
5.5.00.0100.12333.39
5.4.450.0100.13032.78
5.4.440.0070.13032.89
5.4.430.0200.10332.99
5.4.420.0100.11032.83
5.4.410.0130.11332.67
5.4.400.0070.13032.57
5.4.390.0100.09332.43
5.4.380.0130.13032.52
5.4.370.0230.10032.63
5.4.360.0270.10332.63
5.4.350.0170.12332.61
5.4.340.0130.12032.45
5.4.320.0170.12332.45
5.4.310.0200.10732.53
5.4.300.0170.11732.72
5.4.290.0030.13332.81
5.4.280.0100.13332.51
5.4.270.0130.07732.45
5.4.260.0230.08332.63
5.4.250.0130.10732.53
5.4.240.0170.12032.59
5.4.230.0030.08732.44
5.4.220.0130.08032.52
5.4.210.0030.08032.41
5.4.200.0000.08332.50
5.4.190.0070.10732.49
5.4.180.0130.12732.61
5.4.170.0170.10332.44
5.4.160.0030.08032.51
5.4.150.0000.08732.79
5.4.140.0130.07330.00
5.4.130.0070.07029.95
5.4.120.0030.07729.74
5.4.110.0070.07329.98
5.4.100.0000.07729.96
5.4.90.0100.07029.63
5.4.80.0170.06729.82
5.4.70.0000.07729.39
5.4.60.0130.09329.64
5.4.50.0070.12729.47
5.4.40.0130.10729.68
5.4.30.0100.12729.65
5.4.20.0130.12029.70
5.4.10.0200.12329.80
5.4.00.0070.11329.02
5.3.290.0100.11327.79
5.3.280.0130.07327.79
5.3.270.0100.09027.81
5.3.260.0070.07727.73
5.3.250.0100.07327.89
5.3.240.0030.08327.65
5.3.230.0070.07327.63
5.3.220.0130.10027.69
5.3.210.0030.07727.52
5.3.200.0030.08027.86
5.3.190.0100.07327.63
5.3.180.0130.06727.60
5.3.170.0070.07327.68
5.3.160.0030.08027.63
5.3.150.0070.09327.61
5.3.140.0200.12727.65
5.3.130.0070.12327.66
5.3.120.0130.11327.66
5.3.110.0070.10027.61
5.3.100.0170.09727.14
5.3.90.0130.11327.20
5.3.80.0170.09327.20
5.3.70.0070.12027.20
5.3.60.0230.10327.19
5.3.50.0170.11327.00
5.3.40.0100.12327.01
5.3.30.0070.13327.02
5.3.20.0230.12326.88
5.3.10.0030.11726.77
5.3.00.0070.11726.92
5.2.170.0130.10723.44
5.2.160.0230.11023.48
5.2.150.0070.10323.84
5.2.140.0170.11723.45
5.2.130.0170.11023.33
5.2.120.0330.07323.43
5.2.110.0130.11323.41
5.2.100.0070.10023.50
5.2.90.0100.10323.41
5.2.80.0130.11023.55
5.2.70.0170.10323.61
5.2.60.0130.11323.23
5.2.50.0100.11723.33
5.2.40.0100.12323.32
5.2.30.0100.11323.52
5.2.20.0130.11723.14
5.2.10.0130.11323.41
5.2.00.0130.11023.12
5.1.60.0130.12326.54
5.1.50.0130.14326.55
5.1.40.0100.13026.55
5.1.30.0000.13726.96
5.1.20.0130.13327.15
5.1.10.0300.10026.62
5.1.00.0130.10326.80
5.0.50.0070.13725.10
5.0.40.0100.11025.04
5.0.30.0030.15724.75
5.0.20.0100.11724.72
5.0.10.0130.12024.74
5.0.00.0100.14724.67
4.4.90.0100.11722.52
4.4.80.0070.11722.54
4.4.70.0130.12022.50
4.4.60.0130.12322.60
4.4.50.0170.11322.59
4.4.40.0130.12722.51
4.4.30.0130.11722.61
4.4.20.0130.10322.71
4.4.10.0170.10722.58
4.4.00.0100.12722.63
4.3.110.0100.11722.44
4.3.100.0070.11022.51
4.3.90.0200.10322.51
4.3.80.0000.14322.43
4.3.70.0100.11022.28
4.3.60.0130.11722.48
4.3.50.0170.11322.41
4.3.40.0100.13022.39
4.3.30.0200.11021.05
4.3.20.0000.13021.25
4.3.10.0070.10021.10
4.3.00.0170.10321.22

preferences:
36.69 ms | 400 KiB | 5 Q