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); } GeneratePassword(10, 'asdafdfgsaffhdhsd');
Output for 5.3.0 - 5.3.22, 5.3.24, 5.4.0 - 5.4.12, 5.4.14
Fatal error: Cannot use [] for reading in uANlF on line 11
Process exited with code 255.
Output for 5.3.23, 5.4.13
Fatal error: Cannot use [] for reading in /in/Su9RY on line 11
Process exited with code 255.

preferences:
176.13 ms | 1395 KiB | 47 Q