Shuffles a string randomly

by Nithya 2012-05-21 12:12:50

str_shuffle() shuffles a string

$str = 'rtewtfsdf';
$shuffled = str_shuffle($str);


Simple random password generator using str_shuffle
function random_password($chars=11)
{
$letters = 'abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
return substr(str_shuffle($letters), 0, $chars);
}
$res = random_password();
echo $res;

Tagged in:

927
like
0
dislike
0
mail
flag

You must LOGIN to add comments