PHP Code Random Code Generator
<?php
$string="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";//62 is the length of the string. You can check the length of a string using
//strlen($string) function
$limit=10;
$i=0;
$code="";
while($i<$limit)
{
$rand=rand(0,62);
$code=$code.$string[$rand];
$i++;
}
echo $code;
?>
The code above will return 10 random characters from the $string and will generate something like the output below.
Sample Output Random Code Generator
fBicU0qbbG / m8I3h7FEjU
Thank you for visiting and hope this helps you. Feel free to leave a comment below for any questions. I got some other articles related to php and mysql here in my blog. Watch out for more upcoming tutorials related to blogging and programming. Good day! ^_^
No comments:
Post a Comment