create a random string

// Generate a random password
$pwd = "";
$alNum =
array('a','b','c','d','e','f','g','h','i','j','k','m','n','o',
  'p','q','r','s','t','u','v','x','y','z','A','B','C','D','E',
  'F','G','H','I','J','K','M','N','P','Q','R','S','T','U',
  'V','W','X','Y','Z','2','3','4','5','6','7','8','9');
$t = time();
mt_srand($t);
for ($i=0; $i < 8; $i++) {
  $rNum = mt_rand(0,56);
  $pwd .= $alNum[$rNum];
}
Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in Coding, PHP Code Snippets and tagged , , , , , , , , . Bookmark the permalink.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s