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)
5.4.250.0060.03712.39
5.4.240.0000.05718.65
5.4.230.0170.04018.88
5.4.220.0070.07318.80
5.4.210.0030.07018.78
5.4.200.0030.06319.01
5.4.190.0030.05718.97
5.4.180.0170.05718.77
5.4.170.0100.05718.76
5.4.160.0100.04718.81
5.4.150.0100.05018.77
5.4.140.0030.05316.50
5.4.130.0070.04716.57
5.4.120.0000.06716.34
5.4.110.0030.05016.42
5.4.100.0100.04716.48
5.4.90.0000.05016.64
5.4.80.0070.07716.52
5.4.70.0100.04716.59
5.4.60.0100.04716.46
5.4.50.0000.05716.40
5.4.40.0070.06716.42
5.4.30.0200.04316.48
5.4.20.0070.05316.61
5.4.10.0100.05316.32
5.4.00.0200.05015.94
5.3.280.0170.04014.29
5.3.270.0030.05314.38
5.3.260.0100.06014.45
5.3.250.0130.04314.30
5.3.240.0100.05014.50
5.3.230.0000.05714.61
5.3.220.0130.04314.58
5.3.210.0100.04714.42
5.3.200.0030.05014.56
5.3.190.0070.06314.67
5.3.180.0070.05014.27
5.3.170.0000.05714.34
5.3.160.0070.07014.40
5.3.150.0070.07314.61
5.3.140.0070.06714.26
5.3.130.0170.07314.46
5.3.120.0130.06714.64
5.3.110.0030.08014.39
5.3.100.0030.06314.05
5.3.90.0030.08014.11
5.3.80.0100.05314.07
5.3.70.0100.06714.02
5.3.60.0170.04313.94
5.3.50.0170.04014.10
5.3.40.0030.05013.78
5.3.30.0100.06013.68
5.3.20.0070.06013.55
5.3.10.0170.05313.66
5.3.00.0070.04713.58

preferences:
141.19 ms | 1394 KiB | 7 Q