3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generateRandomName($minLength, $maxLength, $alphaNumericOnly = false) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (!$alphaNumericOnly) $chars .= ' '; $randomString = ''; $length = mt_rand($minLength, $maxLength); for ($i = 0; $i < $length; $i++) { $randomString .= $chars[rand(0, strlen($chars) - 1)]; } return $randomString; } $time = microtime(true); $i=0; while($i < 10000) { $i++; $this->generateRandomName(10, 18); } $time = microtime(true) - $time; echo 'took ' . number_format($time, 3);

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.0060.01114.97
7.3.120.0080.00814.85
7.3.110.0080.00614.67
7.3.100.0030.01014.85
7.3.90.0080.00314.87
7.3.80.0030.00714.82
7.3.70.0070.00614.93
7.3.60.0040.00814.74
7.3.50.0040.00814.68
7.3.40.0050.00714.76
7.3.30.0050.00614.69
7.3.20.0080.00316.63
7.3.10.0100.00716.60
7.3.00.0060.00916.40
7.2.250.0120.00715.00
7.2.240.0050.01414.94
7.2.230.0050.01014.81
7.2.220.0030.00815.07
7.2.210.0030.01115.08
7.2.200.0020.01314.85
7.2.190.0070.00515.03
7.2.180.0030.00915.03
7.2.170.0060.00714.89
7.2.130.0100.01016.35
7.2.120.0140.01015.91
7.2.110.0130.01016.39
7.2.100.0220.00616.80
7.2.90.0170.00716.57
7.2.80.0090.01216.46
7.2.70.0170.00316.52
7.2.60.0150.00416.63
7.2.50.0120.00616.41
7.2.40.0090.00916.50
7.2.30.0070.01116.01
7.2.20.0070.01016.23
7.2.10.0130.02016.82
7.2.00.0170.00917.98
7.1.330.0040.01015.67
7.1.320.0050.00915.79
7.1.310.0030.01115.69
7.1.300.0060.00515.72
7.1.290.0030.00715.65
7.1.280.0020.01115.84
7.1.270.0050.00515.65
7.1.260.0060.00715.70
7.1.250.0250.00415.51
7.1.70.0060.01317.09
7.1.60.0100.01319.33
7.1.50.0100.01316.73
7.1.00.0070.07322.27
7.0.200.0260.00414.85
7.0.140.0030.07322.15
7.0.60.0100.07020.09
7.0.50.0000.06317.75
7.0.40.0000.04720.08
7.0.30.0530.06720.16
7.0.20.0170.08720.19
7.0.10.0200.05720.24
7.0.00.0100.05020.06
5.6.280.0000.07720.93
5.6.210.0030.04720.48
5.6.200.0030.06718.12
5.6.190.0100.07720.61
5.6.180.0400.05020.57
5.6.170.0270.05320.55
5.6.160.0030.04320.44
5.6.150.0000.04018.25
5.6.140.0030.08318.14
5.6.130.0130.07718.21
5.6.120.0070.03721.00
5.6.110.0130.07720.98
5.6.100.0070.07720.99
5.6.90.0100.06020.99
5.6.80.0000.09020.38
5.6.70.0330.06020.48
5.5.350.0130.07720.50
5.5.340.0070.07318.05
5.5.330.0130.08020.41
5.5.320.0300.06720.35
5.5.310.0230.06720.51
5.5.300.0070.08717.99
5.5.290.0130.06718.01
5.5.280.0030.04720.85
5.5.270.0070.03720.96
5.5.260.0000.06020.96
5.5.250.0130.05020.71
5.5.240.0130.06720.32
5.4.450.0130.06319.72
5.4.440.0230.06719.34
5.4.430.0230.06019.16
5.4.420.0230.05719.61
5.4.410.0100.05719.45
5.4.400.1070.04719.16
5.4.390.0600.06319.30
5.4.380.0330.05318.79
5.4.370.0300.05318.55
5.4.360.0370.06718.62
5.4.350.0300.05718.74
5.4.340.0430.05718.79
5.4.320.0080.03412.50
5.4.310.0080.03712.50
5.4.300.0060.03712.50
5.4.290.0050.05212.50
5.4.280.0050.03612.40
5.4.270.0060.03612.39
5.4.260.0050.03912.39
5.4.250.0080.03512.40
5.4.240.0030.03912.40
5.4.230.0050.04012.39
5.4.220.0040.03812.39
5.4.210.0090.04712.39
5.4.200.0070.03612.39
5.4.190.0050.03812.39
5.4.180.0080.04712.39
5.4.170.0240.09512.38
5.4.160.0170.04412.37
5.4.150.0200.04712.37
5.4.140.0500.10812.05
5.4.130.0200.04512.04
5.4.120.0120.04712.00
5.4.110.0210.04111.99
5.4.100.0190.04311.99
5.4.90.0130.04912.00
5.4.80.0230.07111.99
5.4.70.0360.08811.99
5.4.60.0160.05011.98
5.4.50.0150.04411.98
5.4.40.0310.09311.98
5.4.30.0150.05011.97
5.4.20.0210.04411.97
5.4.10.0230.07011.97
5.4.00.0370.08711.46
5.3.290.0060.03812.80
5.3.280.0030.03912.71
5.3.270.0260.05012.73
5.3.260.0210.05312.71
5.3.250.0200.04812.72
5.3.240.0510.07312.72
5.3.230.0210.04412.71
5.3.220.0170.04612.68
5.3.210.0360.09012.68
5.3.200.0220.04012.68
5.3.190.0210.04312.67
5.3.180.0370.05612.67
5.3.170.0180.04712.67
5.3.160.0220.04212.67
5.3.150.0200.04012.67
5.3.140.0170.04412.66
5.3.130.0170.04312.66
5.3.120.0190.04112.66
5.3.110.0170.04412.66
5.3.100.0190.04112.12
5.3.90.0190.04012.10
5.3.80.0450.07812.08
5.3.70.0160.04812.08
5.3.60.0150.04912.06
5.3.50.0230.03812.01
5.3.40.0340.08612.01
5.3.30.0160.04112.00
5.3.20.0140.04411.76
5.3.10.0180.03811.72
5.3.00.0140.04211.70
5.2.170.0120.0359.21
5.2.160.0140.0329.21
5.2.150.0130.0349.21
5.2.140.0140.0339.21
5.2.130.0100.0379.17
5.2.120.0090.0379.17
5.2.110.0100.0379.17
5.2.100.0150.0319.18
5.2.90.0090.0379.18
5.2.80.0090.0389.16
5.2.70.0230.0559.16
5.2.60.0150.0349.12
5.2.50.0140.0329.08
5.2.40.0200.0289.07
5.2.30.0130.0349.04
5.2.20.0120.0359.04
5.2.10.0130.0338.94
5.2.00.0110.0358.80
5.1.60.0110.0318.07
5.1.50.0110.0298.07
5.1.40.0130.0268.07
5.1.30.0110.0318.41
5.1.20.0080.0348.44
5.1.10.0270.0458.16
5.1.00.0120.0318.16
5.0.50.0110.0236.64
5.0.40.0110.0216.49
5.0.30.0110.0346.31
5.0.20.0080.0256.28
5.0.10.0130.0186.26
5.0.00.0080.0366.25
4.4.90.0220.0354.78
4.4.80.0040.0214.76
4.4.70.0080.0204.75
4.4.60.0070.0194.75
4.4.50.0060.0204.77
4.4.40.0060.0314.71
4.4.30.0090.0174.76
4.4.20.0060.0214.84
4.4.10.0100.0164.85
4.4.00.0100.0264.76
4.3.110.0070.0184.66
4.3.100.0080.0164.67
4.3.90.0070.0174.63
4.3.80.0060.0284.59
4.3.70.0070.0174.63
4.3.60.0060.0184.63
4.3.50.0040.0214.63
4.3.40.0100.0244.54
4.3.30.0080.0163.33
4.3.20.0060.0173.32
4.3.10.0070.0163.28
4.3.00.0070.0237.81

preferences:
35.34 ms | 401 KiB | 5 Q