By calling str_shuffle method in PHP, we can generate a random mix of latters and numbers.
For example, if we want to fill $bookid string variable with 10 letters and numbers (mixed of them), we can do it this way:
$bookid = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 5)), 0, 10);
And the result is this: nzm5gnde9i
You can modify the content of allowed characters and numbers, maybe you want to limit it to numbers only, simply change it to only contains 0 to 9 numbers.
Or if you wish to mix between uppercase and lowercase letters, simply add A to Z in capital. That will work.
That’s all.