3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mode = '12345'; $length = 8; $small = 'abcdefghijklmnopqrstuvwxyz'; $large = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $numeric = '0123456789'; switch ($mode) { // 小文字英字 case 'small': $chars = $small; break; // 大文字英字 case 'large': $chars = $large; break; // 小文字英数字 case 'smallalnum': $chars = $small . $numeric; break; // 大文字英数字 case 'largealnum': $chars = $large . $numeric; break; // 数字 case 'num': $chars = $numeric; break; // 大小文字英字 case 'alphabet': $chars = $small . $large; break; // 大小文字英数字 case 'alnum': default: $chars = $small . $large . $numeric; break; } $charsLength = strlen($chars); $password = ''; for ($i = 0; $i < $length; ++$i) { $num = mt_rand(0, $charsLength - 1); $password .= $chars{$num}; } echo $password;

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.0080.01014.79
7.3.120.0060.01314.96
7.3.110.0070.01114.81
7.3.100.0040.00714.92
7.3.90.0030.00814.91
7.3.80.0080.00714.72
7.3.70.0090.00114.68
7.3.60.0080.00614.79
7.3.50.0050.00714.91
7.3.40.0090.00614.83
7.3.30.0080.00814.77
7.3.20.0060.00616.51
7.3.10.0040.00716.52
7.3.00.0060.00916.57
7.2.250.0120.00714.94
7.2.240.0080.01015.05
7.2.230.0070.00514.89
7.2.220.0030.01315.25
7.2.210.0120.00315.06
7.2.200.0080.00315.06
7.2.190.0050.00815.18
7.2.180.0080.00315.04
7.2.170.0020.01415.18
7.1.330.0050.01015.63
7.1.320.0050.00815.85
7.1.310.0020.01115.67
7.1.300.0030.01115.71
7.1.290.0050.00915.79
7.1.280.0070.00515.84
7.1.270.0060.00715.69
7.1.260.0030.01015.86
7.1.70.0090.00017.09
7.1.60.0140.01119.43
7.1.50.0000.02116.65
7.1.00.0000.04722.57
7.0.200.0030.00616.45
7.0.140.0000.07722.15
7.0.60.0200.07719.93
7.0.50.0030.05017.80
7.0.40.0100.05320.09
7.0.30.0370.06720.13
7.0.20.0400.04020.00
7.0.10.0100.08720.16
7.0.00.0100.07720.01
5.6.280.0000.07721.12
5.6.210.0200.06320.49
5.6.200.0030.05718.18
5.6.190.0170.08020.45
5.6.180.0330.04720.41
5.6.170.0330.07720.48
5.6.160.0030.04720.40
5.6.150.0130.07318.12
5.6.140.0070.04718.18
5.6.130.0070.08318.15
5.6.120.0100.03720.95
5.6.110.0030.08721.13
5.6.100.0000.04321.11
5.6.90.0070.05720.88
5.6.80.0070.08020.37
5.6.70.4330.04020.48
5.5.350.0170.07320.37
5.5.340.0070.08317.88
5.5.330.0070.04020.43
5.5.320.0030.07020.34
5.5.310.0130.04020.41
5.5.300.0030.08317.98
5.5.290.0130.06718.02
5.5.280.0070.05020.98
5.5.270.0030.04320.87
5.5.260.0030.05320.97
5.5.250.0030.04020.50
5.5.240.0330.07020.35
5.4.450.0730.05719.48
5.4.440.0800.06019.41
5.4.430.0970.05319.27
5.4.420.1000.04319.63
5.4.410.1000.06019.32
5.4.400.0330.05318.83
5.4.390.0330.05318.67
5.4.380.0170.06018.72
5.4.370.0170.05018.77
5.4.360.0230.07318.67
5.4.350.0070.03311.98
5.4.340.0040.03711.98
5.4.320.0040.03812.46
5.4.310.0090.05012.46
5.4.300.0010.04812.46
5.4.290.0090.04512.46
5.4.280.0080.04312.36
5.4.270.0050.04512.36
5.4.260.0080.03612.36
5.4.250.0060.04212.36
5.4.240.0170.05718.77
5.4.230.0070.06319.01
5.4.220.0200.05018.93
5.4.210.0100.07018.79
5.4.200.0130.05318.89
5.4.190.0100.05318.78
5.4.180.0200.05318.89
5.4.170.0270.04018.88
5.4.160.0070.08018.86
5.4.150.0170.05018.63
5.4.140.0070.05316.41
5.4.130.0200.03316.25
5.4.120.0200.05716.20
5.4.110.0170.06316.48
5.4.100.0070.06016.48
5.4.90.0070.07716.38
5.4.80.0100.06316.21
5.4.70.0130.06716.49
5.4.60.0100.05016.45
5.4.50.0130.04716.37
5.4.40.0130.05016.25
5.4.30.0070.05316.41
5.4.20.0030.07716.48
5.4.10.0170.05316.39
5.4.00.0070.05315.65
5.3.290.0060.03812.80
5.3.280.0130.05314.44
5.3.270.0100.07714.47
5.3.260.0100.05314.61
5.3.250.0070.07714.63
5.3.240.0030.07314.63
5.3.230.0100.05014.62
5.3.220.0100.06014.49
5.3.210.0170.06314.62
5.3.200.0070.07714.59
5.3.190.0100.07014.67
5.3.180.0100.07014.43
5.3.170.0200.06014.29
5.3.160.0200.06714.49
5.3.150.0070.05314.73
5.3.140.0100.04714.57
5.3.130.0100.07014.57
5.3.120.0100.06014.55
5.3.110.0130.05714.39
5.3.100.0070.06014.06
5.3.90.0070.06013.73
5.3.80.0100.06013.80
5.3.70.0130.05013.86
5.3.60.0030.06014.05
5.3.50.0100.04713.80
5.3.40.0100.05013.81
5.3.30.0130.05713.77
5.3.20.0130.04313.54
5.3.10.0070.07013.68
5.3.00.0070.05013.70
5.2.170.0100.05710.99
5.2.160.0100.03711.27
5.2.150.0200.04711.16
5.2.140.0100.05711.07
5.2.130.0130.04310.88
5.2.120.0130.04711.02
5.2.110.0100.04010.95
5.2.100.0070.05310.88
5.2.90.0100.03711.02
5.2.80.0030.04711.11
5.2.70.0100.05711.09
5.2.60.0070.04010.90
5.2.50.0030.04310.92
5.2.40.0070.04311.02
5.2.30.0170.03010.98
5.2.20.0070.03710.98
5.2.10.0100.04710.77
5.2.00.0200.05310.68
5.1.60.0100.03310.16
5.1.50.0100.04310.04
5.1.40.0070.04710.04
5.1.30.0100.03310.32
5.1.20.0070.04310.28
5.1.10.0100.03310.17
5.1.00.0000.05710.14
5.0.50.0070.0379.95
5.0.40.0070.0239.95
5.0.30.0030.0439.95
5.0.20.0070.0239.95
5.0.10.0030.0409.95
5.0.00.0100.0339.95
4.4.90.0000.0239.96
4.4.80.0030.0209.96
4.4.70.0070.0179.96
4.4.60.0030.0279.96
4.4.50.0070.0239.96
4.4.40.0000.0509.95
4.4.30.0070.0239.95
4.4.20.0030.0309.95
4.4.10.0070.0279.95
4.4.00.0070.0439.95
4.3.110.0030.0209.95
4.3.100.0030.0209.95
4.3.90.0030.0209.95
4.3.80.0030.0479.95
4.3.70.0070.0239.95
4.3.60.0000.0239.95
4.3.50.0030.0279.95
4.3.40.0030.0409.95
4.3.30.0000.0239.95
4.3.20.0030.0209.95
4.3.10.0000.0239.95
4.3.00.0100.0236.73

preferences:
48.97 ms | 401 KiB | 5 Q