3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function generateRandomString($length = 22) { return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length); } $generated = []; for ($i = 0; $i < 10000; $i++) { $generated[] = generateRandomString(); } var_dump(count(array_unique($generated)));
Output for 7.3.0rc3
int(10000)