Subscribe For Free Updates!

We'll not spam mate! We promise.

May 2, 2013

Random String Generator in PHP



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;
}
?>

TechniqZone Socializer Widget
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment