3v4l.org

run code in 300+ PHP versions simultaneously
<?php function passwordCreate ($length = 8, $mode = '12345') { $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}; } return $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.3.120.0070.00714.79
7.3.110.0000.01314.86
7.3.100.0100.00714.37
7.3.90.0000.01314.36
7.3.80.0060.00614.54
7.3.70.0040.00814.51
7.3.60.0030.00914.37
7.3.50.0030.01014.51
7.3.40.0110.00414.65
7.3.30.0030.01514.70
7.3.20.0130.00316.46
7.3.10.0060.00816.38
7.3.00.0050.00716.40
7.2.240.0030.01514.79
7.2.230.0040.01114.41
7.2.220.0060.00614.98
7.2.210.0040.01414.88
7.2.200.0040.01114.91
7.2.190.0120.00314.64
7.2.180.0070.01014.94
7.2.170.0100.00714.98
7.2.160.0090.00614.99
7.2.150.0060.00916.35
7.2.140.0080.00416.52
7.2.130.0030.01116.43
7.2.120.0070.00516.65
7.2.110.0050.00916.61
7.2.100.0050.00716.60
7.2.90.0070.00816.75
7.2.80.0050.00816.67
7.2.70.0090.00616.62
7.2.60.0080.00816.66
7.2.50.0060.00716.74
7.2.40.0030.01216.56
7.2.30.0050.00716.75
7.2.20.0050.00716.71
7.2.10.0070.00816.63
7.2.00.0060.00817.10
7.1.330.0050.00815.53
7.1.320.0030.01415.47
7.1.310.0030.00915.88
7.1.300.0120.00415.52
7.1.290.0030.00915.60
7.1.280.0000.01615.64
7.1.270.0090.00615.48
7.1.260.0030.01415.44
7.1.250.0070.00615.59
7.1.240.0100.00315.51
7.1.230.0060.00915.41
7.1.220.0000.01015.62
7.1.210.0110.00315.57
7.1.200.0090.00915.31
7.1.190.0080.01215.63
7.1.180.0120.00915.32
7.1.170.0070.00715.76
7.1.160.0120.00015.62
7.1.150.0040.00815.34
7.1.140.0100.00715.43
7.1.130.0070.00715.42
7.1.120.0040.00715.38
7.1.110.0030.00715.61
7.1.100.0040.00915.36
7.1.90.0030.00715.45
7.1.80.0000.01415.34
7.1.70.0090.00316.27
7.1.60.0030.01317.55
7.1.50.0050.00916.16
7.1.40.0000.00915.15
7.1.30.0040.00415.55
7.1.20.0040.01415.64
7.1.10.0030.00915.66
7.1.00.0090.03518.95
7.0.330.0030.01015.11
7.0.320.0060.00915.14
7.0.310.0100.00514.98
7.0.300.0130.00614.91
7.0.290.0030.00815.04
7.0.280.0110.00314.93
7.0.270.0040.00815.28
7.0.260.0120.00015.20
7.0.250.0080.00315.36
7.0.240.0030.00615.14
7.0.230.0000.00815.36
7.0.220.0070.00714.97
7.0.210.0040.00414.88
7.0.200.0050.00615.90
7.0.190.0000.01015.33
7.0.180.0080.00415.16
7.0.170.0100.00315.19
7.0.160.0060.00914.79
7.0.150.0040.00715.16
7.0.140.0030.03918.51
7.0.130.0040.00414.90
7.0.120.0000.01415.13
7.0.110.0080.00414.87
7.0.100.0060.00615.02
7.0.90.0030.01015.11
7.0.80.0060.00615.03
7.0.70.0030.00615.16
7.0.60.0050.02717.55
7.0.50.0100.04216.57
7.0.40.0110.03816.71
7.0.30.0130.02516.88
7.0.20.0170.03516.69
7.0.10.0180.02316.80
7.0.00.0020.05416.66
5.6.380.0000.01314.03
5.6.370.0050.01414.01
5.6.360.0040.01114.27
5.6.350.0100.00713.82
5.6.340.0030.01014.26
5.6.330.0030.00913.70
5.6.320.0110.00413.49
5.6.310.0120.00313.78
5.6.300.0040.00813.89
5.6.290.0000.01113.77
5.6.280.0050.03917.34
5.6.270.0000.01514.25
5.6.260.0000.01214.14
5.6.250.0030.00513.91
5.6.240.0060.00914.07
5.6.230.0070.00713.95
5.6.220.0070.00713.80
5.6.210.0070.04517.25
5.6.200.0030.02616.03
5.6.190.0050.03917.22
5.6.180.0200.03817.22
5.6.170.0190.02717.15
5.6.160.0100.04117.23
5.6.150.0080.03816.03
5.6.140.0050.02315.88
5.6.130.0050.04016.07
5.6.120.0130.04017.55
5.6.110.0120.04217.37
5.6.100.0070.04717.41
5.6.90.0070.04517.52
5.6.80.0090.03417.20
5.6.70.0180.04017.10
5.6.60.0030.01014.18
5.6.50.0070.00713.89
5.6.40.0000.01313.93
5.6.30.0070.00713.77
5.6.20.0130.00313.85
5.6.10.0000.00913.63
5.6.00.0030.00514.07
5.5.380.0090.00311.05
5.5.370.0040.00810.52
5.5.360.0030.00610.65
5.5.350.0040.04515.49
5.5.340.0060.02314.38
5.5.330.0100.04415.54
5.5.320.0200.03715.36
5.5.310.0170.03815.51
5.5.300.0070.03914.08
5.5.290.0050.02214.25
5.5.280.0050.04315.80
5.5.270.0050.04715.78
5.5.260.0060.02015.52
5.5.250.0020.03615.76
5.5.240.0080.03715.56
5.5.230.0060.00010.57
5.5.220.0030.00710.66
5.5.210.0000.00910.83
5.5.200.0070.00310.78
5.5.190.0030.00910.63
5.5.180.0030.00310.43
5.5.170.0000.01110.57
5.5.160.0040.00810.73
5.5.150.0060.00610.72
5.5.140.0030.00310.90
5.5.130.0040.00410.89
5.5.120.0030.00510.82
5.5.110.0030.00610.59
5.5.100.0060.00611.04
5.5.90.0030.00710.99
5.5.80.0000.00610.70
5.5.70.0060.00310.86
5.5.60.0040.00410.75
5.5.50.0060.00610.90
5.5.40.0030.00710.47
5.5.30.0050.00210.52
5.5.20.0080.00310.77
5.5.10.0080.00010.50
5.5.00.0030.00710.46
5.4.450.0420.02915.09
5.4.440.0410.03515.28
5.4.430.0430.03015.14
5.4.420.0520.03215.00
5.4.410.0630.03315.30
5.4.400.0180.03614.72
5.4.390.0250.02314.50
5.4.380.0150.02814.80
5.4.370.0070.03314.75
5.4.360.0080.02814.64
5.4.350.0060.02011.38
5.4.340.0050.02611.32
5.4.330.0060.00310.50
5.4.320.0040.02211.60
5.4.310.0070.02611.40
5.4.300.0050.02211.65
5.4.290.0050.02311.60
5.4.280.0020.02611.40
5.4.270.0080.02011.49
5.4.260.0070.02911.56
5.4.250.0080.02511.62
5.4.240.0070.03214.86
5.4.230.0080.04014.86
5.4.220.0110.03514.77
5.4.210.0070.02814.84
5.4.200.0050.03414.89
5.4.190.0090.02814.77
5.4.180.0050.02614.79
5.4.170.0050.03314.52
5.4.160.0150.02014.71
5.4.150.0030.03714.87
5.4.140.0080.02813.44
5.4.130.0080.02313.67
5.4.120.0120.02513.50
5.4.110.0070.03013.60
5.4.100.0070.02713.51
5.4.90.0020.02813.50
5.4.80.0030.02913.53
5.4.70.0100.03113.53
5.4.60.0030.03013.47
5.4.50.0080.02813.44
5.4.40.0080.03513.52
5.4.30.0150.02513.71
5.4.20.0060.02613.63
5.4.10.0100.03013.65
5.4.00.0120.02313.39
5.3.290.0040.02511.66
5.3.280.0080.02712.48
5.3.270.0060.02912.61
5.3.260.0070.03112.60
5.3.250.0090.02612.44
5.3.240.0030.03312.31
5.3.230.0020.03012.37
5.3.220.0050.03212.33
5.3.210.0070.03812.46
5.3.200.0050.03212.46
5.3.190.0080.02512.25
5.3.180.0070.02712.52
5.3.170.0020.03212.52
5.3.160.0100.03312.61
5.3.150.0050.03212.46
5.3.140.0060.03612.53
5.3.130.0070.03712.47
5.3.120.0090.02512.46
5.3.110.0160.02412.44
5.3.100.0070.03412.25
5.3.90.0050.03012.30
5.3.80.0050.02612.12
5.3.70.0020.03112.15
5.3.60.0080.02612.24
5.3.50.0030.02912.12
5.3.40.0100.03012.14
5.3.30.0080.03312.19
5.3.20.0080.02511.93
5.3.10.0100.02511.94
5.3.00.0060.03611.76
5.2.170.0020.03010.63
5.2.160.0080.02010.63
5.2.150.0120.02010.63
5.2.140.0050.02210.64
5.2.130.0050.02510.57
5.2.120.0020.02510.57
5.2.110.0100.01710.57
5.2.100.0050.02310.56
5.2.90.0050.02310.62
5.2.80.0030.02510.55
5.2.70.0050.02110.60
5.2.60.0050.03210.55
5.2.50.0080.03210.49
5.2.40.0030.02810.53
5.2.30.0090.02010.54
5.2.20.0050.02810.54
5.2.10.0070.02710.37
5.2.00.0060.02610.40
5.1.60.0030.02010.03
5.1.50.0070.02110.01
5.1.40.0030.0189.99
5.1.30.0080.01710.17
5.1.20.0060.01610.19
5.1.10.0050.01810.04
5.1.00.0020.02210.02
5.0.50.0050.0159.26
5.0.40.0070.0129.21
5.0.30.0050.0279.13
5.0.20.0000.0209.17
5.0.10.0070.0139.15
5.0.00.0030.0249.09
4.4.90.0020.0138.49
4.4.80.0020.0158.49
4.4.70.0020.0138.49
4.4.60.0020.0158.49
4.4.50.0030.0128.49
4.4.40.0030.0198.49
4.4.30.0050.0108.49
4.4.20.0030.0178.49
4.4.10.0020.0138.49
4.4.00.0010.0208.49
4.3.110.0030.0138.49
4.3.100.0000.0158.49
4.3.90.0050.0118.49
4.3.80.0000.0198.49
4.3.70.0020.0128.49
4.3.60.0050.0098.49
4.3.50.0000.0208.49
4.3.40.0020.0228.49
4.3.30.0030.0118.49
4.3.20.0070.0088.49
4.3.10.0030.0118.49
4.3.00.0070.0128.44

preferences:
32.64 ms | 401 KiB | 5 Q