Creates a string of random characters
str_random(int $length, string $alphabet): string
length
The length of the returned string
length
The characters allowed in the result
A random string of length with characters from the alphabet.
Example # 1 Example uses of str_random()
echo str_random(5);
The above example may output:
uwceb
Example # 2 Example uses of str_random() with a custom alphabet
echo str_random(5, 'def');
The above example may output:
ddefe