3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomFilePrefix($length = 10) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $randomstr = ""; for($i = 0; $i < $length; $i++) { $randomstr .= $chars[rand(0, count($chars)]; } return $randomstr; } echo randomFilePrefix(10);
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Parse error: syntax error, unexpected ']' in /in/hBFSF on line 9
Process exited with code 255.

preferences:
179.36 ms | 1395 KiB | 53 Q