3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GeneratePassword ($length,$chars) { $res = array(); $char_length = strlen($chars); for($i = 0; $i < $length; $i++) { $res[] = $chars[rand(0,$char_length)]; } return implode('', $res); } echo generatePassword($length = 16) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.25, 5.5.0 - 5.5.9
Parse error: syntax error, unexpected '{', expecting ',' or ';' in /in/TILJm on line 17
Process exited with code 255.

preferences:
189.19 ms | 1387 KiB | 72 Q