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'; $count = mb_strlen($chars);
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '{', expecting ',' or ';' in /in/SDUHH on line 17
Process exited with code 255.

preferences:
185.74 ms | 1395 KiB | 62 Q