str shuffle Function
Syntax:
str_shuffle(string)
str_shuffle(string)
The str_shuffle() function randomly shuffles all the characters of a string.
The str_shuffle() function is mainly used for to to generate a random password or produce random characters for CAPTCHA validation image.
Each time this function executes and it will randomly re-shuffle the string.
The str_shuffle() function is mainly used for to to generate a random password or produce random characters for CAPTCHA validation image.
Each time this function executes and it will randomly re-shuffle the string.
Example: 1
<?php$string = 'This is a test';
$x=str_shuffle($string);
echo $x;
?>
Output
aih istT sestRandom character generator.
Example: 2
<?php$string = 'abcdefghijklmnopqrstwxyz0123456789';
$x=str_shuffle($string);
$y = substr($x,0, 5);
echo $y;
?>
Output
g1c3w
Example: 3
<?php$string = 'abcdefghijklmnopqrstwxyz0123456789';
$x=str_shuffle($string);
$y = substr($x,0, strlen($string)/2);
echo $y;
?>
Output
57zo04xp3hykcl1ei
See a password generator program below the link:
Password Generator Program
No comments:
Post a Comment