Random string generator

Random string generator. Optionally, you can give it a desired string length.

function rnd_string($len = 24)
{
    $str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $strlen = strlen($str) - 1;
    $result = '';
    for ($i = 0; $i < $len; $i++)
        $result .= $str[rand(0, $strlen)];
    return $result;
}
 
echo rnd_string();

Tags

No tag here.

Recommended pages

Gregorian to Persian Date Convertor...

Gregorian to Persian Date Convertor....

PHP subwords() Function...

Function subwords, gets words by max num....

Extract numbers from a unicode string...

Quick extract numbers from a unicode string......

Get all subsets of array...

If you have a list of items (for example)......