Random String Generator in PHP:
The following function "getrandum_str()" is used to get the random string with specified string length.
This function may used to get encrypted key value or generate the random password and etc...
<?php
function getrandum_str()
{
$abc = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$lengt = 10; // set the length of result
$strn = "";
for($i=0;$i<$lengt;$i++)
{
$strn.=$abc[rand(0,strlen($abc)-1)];
}
return $strn;
}
?>
0 comments:
Post a Comment