how to generate random password in php

Generating random strings can be extremely valuable in great deal of situations. You can generate hit-or-miss passwords, any proof limitations and the like. The principle things inside hit-or-miss bowed stringed instrument age group include the followings:

  • Specify your valid figures can be used inside stringed
  • Outline the length of the chain
  • Creating a new randomly range

Consequently after getting an index of the available people then you will want to decide on at least one indiscriminately as well as include it with a result stringed. Recurring the idea before length of the effect line is plenty.

Below You Can get function for Random Password Genration

function randompassword_genrater($length = 6,
$chars = '0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
$random_password = '';
$char_length = strlen($chars);
for ($i = 0; $i < $length; $i++)
$random_number = rand() % $char_length;//rand() is use for random number
$random_password .= $chars[$random_number];//genrate password here
return $random_password;//to return your genrate password here


1)  {php} echo randompassword_genrater(); {/php}//it is return random genrate
     May return: eQhoCM   //ouput
     //it is return alphanumeric number 
     May return: RMJQJEZK  //ouput  
3)   //it is return number only
     May return: 3518   //ouput

About The Massive Technolab

Who We Are

Massive Technolab is a Leading IT services Company in India that expertise in web Development, Web Design and SEO at affordable rates.

Leave a Comment

comments powered by Disqus