3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_string($charcount = 8, $mode = 0, $capsonly = 0) { /* 0 = alphanumeric 1 = letters only 2 = numbers only */ $chars_alpha_cap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $chars_alpha_low = 'abcdefghijklmnopqrstuvwxyz'; $chars_num = '0123456789'; if ($capsonly) { $chars_alpha_cap = ''; $chars_alpha_low = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; } switch ($mode) { case 1: $chars = $chars_alpha_cap . $chars_alpha_low; break; case 2: $chars = $chars_num; break; default: $chars = $chars_alpha_cap . $chars_alpha_low . $chars_num; } $rand = false; for ($i = 0; $i < $charcount; $i++) { $rand .= $chars[mt_rand(0, strlen($chars) - 1)]; } return $rand; } echo random_string(64,0,0);

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.0000.01519.56
7.1.70.0110.00417.22
7.1.60.0140.00719.17
7.1.50.0230.01334.90
7.1.00.0070.05322.33
7.0.200.0040.00416.81
7.0.140.0030.07321.99
7.0.60.0070.06720.06
7.0.50.0030.04317.83
7.0.40.0030.08020.16
7.0.30.0200.04020.20
7.0.20.0370.04720.08
7.0.10.0300.07320.25
7.0.00.0000.05020.08
5.6.280.0000.07720.92
5.6.210.0100.07320.52
5.6.200.0130.07718.25
5.6.190.0130.06720.46
5.6.180.0170.04320.61
5.6.170.0270.05020.47
5.6.160.0130.07720.54
5.6.150.0130.03018.14
5.6.140.0070.03718.13
5.6.130.0170.07318.17
5.6.120.0070.08321.05
5.6.110.0030.04320.91
5.6.100.0030.08320.89
5.6.90.0130.07720.98
5.6.80.0070.03720.29
5.6.70.3630.04720.39
5.5.350.0070.07720.39
5.5.340.0100.07017.92
5.5.330.0130.08020.42
5.5.320.0200.04320.34
5.5.310.0200.08020.32
5.5.300.0130.07317.97
5.5.290.0100.07718.01
5.5.280.0030.04320.67
5.5.270.0070.03720.86
5.5.260.0130.08020.96
5.5.250.0030.04020.66
5.5.240.0000.09020.24
5.4.450.0300.06719.20
5.4.440.0170.04319.41
5.4.430.0330.07019.38
5.4.420.0400.06719.29
5.4.410.0370.05319.24
5.4.400.0200.03319.09
5.4.390.0270.05319.07
5.4.380.0200.04319.19
5.4.370.0470.06018.84
5.4.360.0200.07319.22
5.4.350.0200.07019.16
5.4.340.0270.03019.13
5.4.320.0200.05319.08
5.4.310.0230.04718.96
5.4.300.0230.04019.19
5.4.290.0270.06019.23
5.4.280.0270.05718.95
5.4.270.0200.07319.22
5.4.260.0230.06318.88
5.4.250.0230.06018.94
5.4.240.0300.06719.12
5.4.230.0470.05319.09
5.4.220.0430.04019.08
5.4.210.0230.05718.86
5.4.200.0100.05019.21
5.4.190.0300.07719.15
5.4.180.0270.03719.21
5.4.170.0170.06318.86
5.4.160.0170.05719.04
5.4.150.0200.07319.29
5.4.140.0470.06016.41
5.4.130.0170.03716.45
5.4.120.0400.05316.28
5.4.110.0270.06316.54
5.4.100.0230.03716.54
5.4.90.0300.06316.55
5.4.80.0300.07016.54
5.4.70.0530.06016.43
5.4.60.0470.04316.43
5.4.50.0300.05316.25
5.4.40.0270.04716.50
5.4.30.0170.05016.30
5.4.20.0270.06316.51
5.4.10.0200.05316.52
5.4.00.0230.06315.96
5.3.290.0230.04714.74
5.3.280.0300.04314.68
5.3.270.0270.06714.68
5.3.260.0200.06714.84
5.3.250.0500.06714.65
5.3.240.0370.06014.70
5.3.230.0230.05714.54
5.3.220.0330.06314.48
5.3.210.0530.06014.64
5.3.200.0230.07714.79
5.3.190.0270.05314.54
5.3.180.0230.07314.57
5.3.170.0230.04714.48
5.3.160.0230.07314.71
5.3.150.0130.05314.54
5.3.140.0070.04714.57
5.3.130.0370.04314.45
5.3.120.0470.06714.63
5.3.110.0370.07314.77
5.3.100.0100.04314.12
5.3.90.0130.03714.03
5.3.80.0570.03013.94
5.3.70.0370.04014.04
5.3.60.0330.06014.12
5.3.50.0430.04313.88
5.3.40.0330.04713.85
5.3.30.0170.03713.98
5.3.20.0200.03313.70
5.3.10.0470.03313.74
5.3.00.0300.03713.56
5.2.170.0130.03011.22
5.2.160.0300.03711.29
5.2.150.0200.05711.06
5.2.140.0200.04011.19
5.2.130.0130.03311.00
5.2.120.0100.03311.07
5.2.110.0130.03311.05
5.2.100.0130.02711.11
5.2.90.0400.03311.15
5.2.80.0170.02711.06
5.2.70.0130.02711.24
5.2.60.0130.03011.06
5.2.50.0130.03311.02
5.2.40.0100.03310.91
5.2.30.0070.03711.13
5.2.20.0100.03711.12
5.2.10.0130.02310.79
5.2.00.0030.02710.66
5.1.60.0000.02710.05
5.1.50.0030.0239.98
5.1.40.0800.0239.91
5.1.30.1230.02710.31
5.1.20.1230.03010.43
5.1.10.1200.0309.95
5.1.00.1330.02710.15
5.0.50.0670.0138.44
5.0.40.0700.0208.34
5.0.30.0600.0308.13
5.0.20.0570.0238.30
5.0.10.0700.0278.09
5.0.00.0530.0308.11
4.4.90.0530.0177.76
4.4.80.0200.0177.76
4.4.70.0000.0207.76
4.4.60.0030.0137.76
4.4.50.0000.0207.76
4.4.40.0000.0277.76
4.4.30.0000.0277.76
4.4.20.0070.0137.76
4.4.10.0000.0177.76
4.4.00.0030.0237.76
4.3.110.0200.0137.76
4.3.100.0600.0177.76
4.3.90.0630.0137.76
4.3.80.0500.0237.76
4.3.70.0630.0137.76
4.3.60.0400.0207.76
4.3.50.0530.0177.76
4.3.40.0530.0277.76
4.3.30.0370.0207.76
4.3.20.0200.0237.76
4.3.10.0170.0177.76
4.3.00.0330.0137.76

preferences:
37.21 ms | 400 KiB | 5 Q