29+ PHP Password Generator Examples

This post contains a total of 29+ Hand-Picked PHP Password Generator examples with Source Code. All these password generators are made using PHP language.

You can use the source code of these examples with credits to the original owner.

Related Posts

PHP Password Generator Examples

1. By Morteza mousavi

Made by Morteza mousavi. Simple PHP Program to generate a 9 digit random password. Source

n5jqDxMn2
<?php

function generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'lud'){
    $sets = array();
    if(strpos($available_sets, 'l') !== false){
        $sets[] = 'abcdefghjkmnpqrstuvwxyz';
    }
    if(strpos($available_sets, 'u') !== false){
        $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ';
    }
    if(strpos($available_sets, 'd') !== false){
        $sets[] = '23456789';
    }
    if(strpos($available_sets, 's') !== false){
        $sets[] = '[email protected]#$%&*?';
    }
    $all = '';
    $password = '';
    foreach($sets as $set){
        $password .= $set[array_rand(str_split($set))];
        $all .= $set;
    }
    $all = str_split($all);
    for($i = 0; $i < $length - count($sets); $i++){
        $password .= $all[array_rand($all)];
    }
    $password = str_shuffle($password);
    if(!$add_dashes){
        return $password;
    }
    $dash_len = floor(sqrt($length));
    $dash_str = '';
    while(strlen($password) > $dash_len){
        $dash_str .= substr($password, 0, $dash_len) . '-';
        $password = substr($password, $dash_len);
    }
    $dash_str .= $password;
    return $dash_str;
}

$a = generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'lud');
echo "$a";

?>

2. By Natalia LoΕΎak

Made by Natalia LoΕΎak. This program generates a 6 digit password. Source

T7M9i$
<?php
    print generatePassword(6);

    function generatePassword($length) {
        if ($length <= 3 || $length > 100) {
                                     return 'Length must be between 3 and 100.';
        }
        $password = '';
        $conditions = [1 => 1, 2 => 2, 3 => 3, 4 => 4];
        while (strlen($password) < $length) {
            $condition = ($length - strlen($password) <= count($conditions)) ? array_rand($conditions) : rand(1, 4);
            unset($conditions[$condition]);
            if ($condition == 1) {
                $char = rand(0, 9);
            } else if ($condition == 2) {
                $char = chr(rand(35, 38));
            } else if ($condition == 3) {
                $char = chr(rand(65, 90));
            } else {
                $char = chr(rand(97,122));
            }
            $password .= $char;
        }
        // $file = fopen("password.txt", "w");
        // fwrite($file, $password);
        // fclose($file);
        return str_shuffle($password);
    }
?>

3. By Metrik

Made by Metrik. The program generates a random password of random length using symbols, numbers and alphabets, it also uses a little bit of styling. Source

113oaa811
<?php
    $layout = "<style>body{background-color:black;color:white;text-shadow:3px 3px 6px grey;font-size:60px; text-align:center;}</style>";
    $int = rand(0,51); 
    $int2 = rand(0,51);
    $int3 = rand(0,51);
    $a_z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    $a_z2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    $a_z3 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    $rand_letter = $a_z[$int]; 
    $num = rand(1 , 99);
    $ran = rand(0 , 30);
    $ran2 = rand(0 , 30);
    $ran3 = rand(0 , 30);
    $sym = "+=%_|<>{}[][email protected]#$/^&*(\`~-':;,?)]}";
    $sym2 = "+=%_|<>{}[][email protected]#$/^&*(\`~-':;,?)]}";
    $sym3 = "+=%_|<>{}[][email protected]#$/^&*(\`~-':;,?)]}";
    $rand_sym = $sym[$ran];
    $rand_letter2 = $a_z2[$int2]; 
    $num2 = rand(1 , 9);
    $rand_sym2 = $sym2[$ran2];
    $rand_letter3 = $a_z3[$int3]; 
    $num3 = rand(1 , 9);
    $rand_sym3 = $sym3[$ran3];
    $lkupnum = rand(0 , 8);
    $lkupnum2 = rand(0 , 8);
    $lkupnum3 = rand(0 , 8);
    $lkupnum4 = rand(0 , 8);
    $lkupnum5 = rand(0 , 8);
    $lkupnum6 = rand(0 , 8);
    $lkupnum7 = rand(0 , 8);
    $lkupnum8 = rand(0 , 8);
    $lkupnum9 = rand(0 , 8);  
    $lkup = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup2 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup3 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup4 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup5 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup6 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup7 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup8 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $lkup9 = $rand_letter . $num . $rand_sym . $rand_letter2 . $num2 . $rand_sym2 . $rand_letter3 . $num3 . $rand_sym3;
    $randpass = $lkup[$lkupnum];
    $randpass2 = $lkup2[$lkupnum2];
    $randpass3 = $lkup3[$lkupnum3];
    $randpass4 = $lkup4[$lkupnum4];
    $randpass5 = $lkup5[$lkupnum5];
    $randpass6 = $lkup6[$lkupnum6];
    $randpass7 = $lkup7[$lkupnum7];
    $randpass8 = $lkup8[$lkupnum8];
    $randpass9 = $lkup9[$lkupnum9]; 
    $pass = $randpass . $randpass2 . $randpass3 . $randpass4 . $randpass5 . $randpass6 . $randpass7 . $randpass8 . $randpass9;
    echo $layout . $pass;

    
?>

4. By Makise Kurisu

Made by Makise Kurisu. The program generates a random 10 digit password. Source

<?php

function generateCode($length= 10){
	$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	$code = '';
	$cl = strlen($chars) - 1;
	while (strlen($code) < $length) {
	    $code .= $chars[mt_rand(0, $cl)];
	}
	return $code;
}

echo generateCode()

?>

5. By Gopal Krishna Sharma

Made by Gopal Krishna Sharma. This password generator generates a total of three passwords which are four, eight and twelve characters in length. Source


        <?php
        echo "<b>Strong passwords</b>";
        echo "<br />";
        echo "<br />";
          echo "<br />";
          echo "A four character password:";
          echo "<br />";
          echo "<br />";
function password_four($length = 4) {
    $chars = "[email protected]#$%^&*()_-=+;:,.?";
    $p_four = substr(str_shuffle($chars), 0, $length);
    return $p_four;
}
echo password_four();
echo "<br />";
echo "<br />";
echo "A eight character password:";
echo "<br />";
echo "<br />";
function password_eight($length = 8) {
    $chars = "[email protected]#$%^&*()_-=+;:,.?";
    $p_eight = substr(str_shuffle($chars), 0, $length);
    return $p_eight;
}
echo password_eight();
echo "<br />";
echo "<br />";
echo "A twelve character password:";
echo "<br />";
echo "<br />";
function password_twelve($length = 12) {
    $chars = "[email protected]#$%^&*()_-=+;:,.?";
    $p_twelve = substr(str_shuffle($chars), 0, $length);
    return $p_twelve;
}
echo password_twelve();
?>

6. By Alexey Gudym

Made by Alexey Gudym. It generates a random 8 digit password. Source

<?php
function password_generator($length = 8) {
    $aZ09 = array_merge(range('A', 'Z'), range('a', 'z'),range(0, 9));
    $out = '';
    for($c = 0; $c < $length; $c++) {
       $out .= $aZ09[mt_rand(0, count($aZ09)-1)];
    }
    return $out;
}

echo password_generator();

7. By Arbahud Rio Daroyni

Made by Arbahud Rio Daroyni. The program generates a random password that is random in length. Source

<?php  
$letter = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
$char = array("@", "$", "#", "*", "&", "!", "?", "%");
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $char[rand(0, 7)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $char[rand(0, 7)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $char[rand(0, 7)];
?>

8. By Love Barot

Made by Love Barot. A random PHP Password generator that generates a random password containing alphabets, numbers and symbols. Source

<?php
function randomPassword() {
    $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
    $pass = array(); 
    $alphaLength = strlen($alphabet) - 1; 
    for ($i = 0; $i < 8; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); 
}

$result = randomPassword();

echo "your Password is : <b>".$result."</b>";	

9. By ChillPill

Made by ChillPill. The program generates a random password of random length, it also shows the strength of different passwords. Source

<?php
    $password="";
    $plength=15;
    for($i=0;$i<$plength;$i++){
        $password.=chr(rand(33,122));
    }
    echo "<br>"."random password: ".$password;
    
    //evaluating different passwords strengths
    function checkPasswordStrength($pass){
        $hasCap=0;
        $hasLow=0;
        $hasNumber=0;
        $hasSymbol=0;
        $hasEight=strlen($pass)>=8?1:0;
        for($i=0;$i<strlen($pass);$i++){
            $ccode=ord($pass[$i]);  
            if($ccode>=33&&$ccode<=47){
                $hasSymbol=1;
            }elseif($ccode>=48&&$ccode<=57){
                $hasNumber=1;
            }elseif($ccode>=65&&$ccode<=90){
                $hasCap=1;
            }elseif($ccode>=97&&$ccode<=122){
                $hasLow=1;
            }
        }
        $strength=$hasSymbol+$hasNumber+$hasCap+$hasLow+$hasEight;
        echo "<br/> password: ".$pass.", strength: ".$strength."/5";
        echo "<br/><progress min=0 max=5 value=".$strength." ></progress>";
    }
    
    $userPass1="abc123";
    $userPass2="bIngO4";
    $userPass3="#@123ASDFjkl;";
   
    checkPasswordStrength($userPass1);
    checkPasswordStrength($userPass2);
    checkPasswordStrength($userPass3);

?>

10. By Krupa Mehta

Made by Krupa Mehta. Click on the ‘Get Password’ button to generate a random password. The program contains js and css for styling. Source

<?php
  
    $c = 8;
    
    echo "<script>var generator = window.setInterval(gen_pswd, 50);function gen_pswd() {";
    echo "var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-*/';";
    for ($a = 1; $a <= $c; $a++) {
        echo "var pswd$a = document.getElementById('pswd$a');";
        echo "pswd$a.innerHTML = possible.charAt(Math.floor(Math.random() * possible.length));";
    }
    echo "}</script>";
    
    echo "<br><input type='button' value='Get Password' onclick='clearInterval(generator);'/><br><br>";
    for ($b = 1; $b <= $c; $b++)
        echo "<div id='pswd$b'></div>";

    echo "<style>body{background-color:black;}div{color:white;margin:5px;font-size:45px;display:inline;}</style>";
?>

11. By DJ WildLion

Made by DJ WildLion. The program generates a random password that is between 8 – 16 in length. Source

<?php

$length = rand(8,16);
function password_gen($length) {
    $chars = "[email protected]#$%^&*()_-=+;:,.?";
    $password = substr(str_shuffle($chars), 0, $length);
    return $password;
}
echo password_gen($length);
?>

12. By J.R.FOGGO

Made by J.R.FOGGO. CREATES A (RANDOMLY GENERATED) ALPHA-NUMERIC PASSWORD! Source


<?php
    function create_pw($len){
        $pw = "";
        for ($i=0;$i<$len;$i++){
            $r = mt_rand(1,4);
            if ($r == 1) $r = mt_rand(48,57);
            else if ($r == 2) $r = mt_rand(65,90);
            else $r = mt_rand(97,122);
            $pw = $pw . chr($r);
        }
        return $pw;
    }
    echo "<h2 style='margin-top:45%;text-align:center;font-family:Courier New'>new pw = <i>" . create_pw(10) . "</i>.</h2>";
    
?>

13. By DMT

PHP Password Generator by DMT. Change the 33 at the ‘echo generate_password(33);’ line to whatever length of password you want to generate. Source

<?php

echo generate_password(33);

  function generate_password($number)
  {
    $arr = array('a','b','c','d','e','f',
                 'g','h','i','j','k','l',
                 'm','n','o','p','r','s',
                 't','u','v','x','y','z',
                 'A','B','C','D','E','F',
                 'G','H','I','J','K','L',
                 'M','N','O','P','R','S',
                 'T','U','V','X','Y','Z',
                 '1','2','3','4','5','6',
                 '7','8','9','0','.',',',
                 '(',')','[',']','!','?',
                 '&','^','%','@','*','$',
                 '<','>','/','|','+','-',
                 '{','}','`','~');
    $pass = "";
    for($i = 0; $i < $number; $i++)
    {
      $index = rand(0, count($arr) - 1);
      $pass .= $arr[$index];
    }
    return $pass;
  }
?>

14. By Sup4anskiy TV

Made by Sup4anskiy TV. The program generates a random 25 digit password containing numbers, symbols and alphabets. Source

<?php
function PasswordGenerate(){
    $chars = 'qwertyuiopasdfghjklzxcvbn1234567890&[email protected]*^*:;,?-';
    $password = substr(str_shuffle($chars), 0, 25);
    return $password;
}
echo 'password : '.PasswordGenerate();
?>

15. By ARGON2I

Made by ARGON2I. Source

<?php
    
    $arr = array(
    'A','a','B','b','C','c','D',
    'd','E','e','F','f','G','g',
    'H','h','I','i','J','j','K',
    'k','L','l','M','m','N','n',
    'O','o','P','p','Q','q','R',
    'r','S','s','T','t','U','u',
    'V','v','W','w','X','x','Y',
    'y','Z','z','0','1','2','3',
    '4','5','6','7','8','9','+',
    'Γ—','Γ·','=','%','_','!','@',
    '#','$','^','&','-','?','~');
    
    $c = count($arr)-1;
    $max_points = 8;
    $pass = Null;
    
    $i = 0;
    while($i < $max_points){
        $pass .= $arr[rand(0,$c)];
        $i++;
    }

    echo $pass."</br>";
    
    $option = [
        "time_cost" => 5,
        "memory_cost" => 1024,
        "threads" => 4
    ];
    
    echo "PASSWORD_ARGON2I : ". password_hash($pass,PASSWORD_ARGON2I,$option); 
?>

16. By Laurentiu : Pidu

Made by Laurentiu : Pidu. The program generates a random password that is between 0 – 9 in length. Source

<?php
    $str = str_shuffle("[email protected]#$/^&*-:;,+Γ—Γ·=<>%~`_\|ABCDEFGHIJKLMNOPQRDTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz");
    $pass_gen = substr($str, 0, 9);
    echo "Ur password is: ".$pass_gen ;
?>

17. By Elvis Halilovic

Made by Elvis Halilovic. The program generates two random password. Source

<?php

function generatePassword($var = null) {
    $maxLength = 256;
    $minLength = 4;
    $defaultLength = 8;
    $chars = "[email protected]#$%^&*()_-=+;:,.?";
    $var = intval($var);
    if($var <= $maxLength && $var >= $minLength){
        $password = substr(str_shuffle($chars), 0, $var);
    } else {
        $password = substr(str_shuffle($chars), 0, $defaultLength);
    }
    return $password;
}

echo ("Password with default length: " . generatePassword() . "<br> Password with a length off 15 characters: " . generatePassword(15));

?>

18. By Sasha Friends

Made by Sasha Friends. Source

<?php
function numeros_gen($length = 8) {
    $chars = "12345789";
    $numeros = substr(str_shuffle($chars), 0, $length);
    return $numeros;
}
echo '06' 
. password_gen();
function password_gen($length = 8){
   $chars = "azertyuiopqsdfghjklmwxcvbn123456789";
   $pass = substr(str_shuffle($chars ), 0, $length );
   return $pass ;
}echo password_gen();

?>

19. By Mohammed Shamshid

Made by Mohammed Shamshid. Random PHP password generator with styling. Source

<?php
$password ="";
function Genpass(){
    $alphabet = "[email protected]#$%^&*";
 $pass = array();
 $alphaLength = strlen($alphabet) - 1; 
 
 for ($i = 0; $i < 10; $i++) { 
 $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; 
 } 
 return implode($pass);
}
$password = Genpass();

?>

<!DOCTYPE html>
<html> 
<style>
body{
   background: #eee;
   text-align: center;
}

h1 {
   color: #263238;    
}

.generator{
   padding:10px;
   background: #039BE5;
   color: #fff;
   border-radius: 2px;
   font-size: 30px;
   box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.generator:hover {
   background: #43A047;
   color: #fff;
   box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}  
</style>
    <body>
    <h2>PHP Password Generator</h1>
    <div class="generator">
       <?php echo $password; ?>
    </div>
    </body>
</html>

20. By zEmster

Made by zEmster. The program generates a random 8 digit password. Source

<?php function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
 $pass = array(); //remember to declare $pass as an array//
 $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache//
  for ($i = 0; $i < 8; $i++) { 
  $n = rand(0, $alphaLength); 
  $pass[] = $alphabet[$n]; 
  } return implode($pass); //turn the array into a string//
   } echo randomPassword(); 
   ?>

21. By baks

Made by baks. The program generates a 10 digit random password containing symbols, alphabets and numbers. Source

<?php

function check_offset ($randChoice, $spl_words, $spl_numbers, $spl_spec){
    if($randChoice == 0){
        $offsetCount = count($spl_words) - 1;
    } else if ($randChoice == 1){
        $offsetCount = count($spl_numbers) - 1;
    } else if ($randChoice == 2){
        $offsetCount = count($spl_spec) - 1;
    }
    return $offsetCount;
}

function password_Generator ( $password_length ) {
$words ="abcdefghijklmnopgrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$numbers ="1234567890";
$spec ="&_%[email protected]$";

$all = array($words,$numbers,$spec);

$spl_words =str_split($words);
$spl_numbers =str_split($numbers);
$spl_spec =str_split($spec);

$password="";
for($i=0; $i<$password_length; $i++){
    $randChoice = rand(0,2);
    $offsetCount = check_offset($randChoice, $spl_words, $spl_numbers, $spl_spec);
    $randNum = rand(0,$offsetCount);
    $randType = $all[$randChoice];
    $password .= "$randType[$randNum]";
}
return $password; 
}

$password = password_Generator (10);
echo $password ;
 ?>

22. By Ayo Gege Golden Hyped

Made by Ayo Gege Golden Hyped. Source

<?php
    $random=str_shuffle("QWERTYUIOPASDFGHJKLZXCVBNM1234567890");
    echo "Password for you:".
substr($random ,0,8);
?>

23. By Zhokh Ivan

Made by Zhokh Ivan. The program generates a random 7 digit password. Source

<?php

class myApi{
   private $mask ="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM$%&#@1234567890";
public function passGene(){
    return substr(str_shuffle($this->mask),0,7);
   }
   
}
    
$pass= new myApi();
echo $pass->passGene();
?>

24. By CALEB

Made by CALEB. Source

<?php       
function pasgen(){
$pas=("[email protected]##$%^%!&#&$*?143134572567684977890018€889p");
    $y=0;  
       while($y<8){
 $t=rand(1,102);
  echo $pas[$t];
 $y+=1;
 }
  }
pasgen();
?>

25. By FrantiΕ‘ek ChamrΓ‘d

Made by FrantiΕ‘ek ChamrΓ‘d. The program generates a random password of random length. Source

<?php
$abcL = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
$abcU = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$num = array("0","1","2","3","4","5","6","7","8","9");
$char = array("!","\"","#","$","%","&","'","(",")","+",",","-",".",";","@","[","]","^","_","`","{","}","~");
 

$all = array_merge($abcL,$abcU,$num,$char);

$allSize = sizeof($all);

$passwordLength = 15;

    for($i = 0; $i < $passwordLength; $i++)
    {
        $rand = rand(0,($allSize-1));
        
        echo $all[$rand];
    }
?>

26. By Amir.h Akbari

Made by Amir.h Akbari. This code create’s a random 12 characters password. Source

<?php

$str = '0123456789$#^&*[email protected]';

$makeArray = str_split($str);
$random = shuffle($makeArray);
    $length = 12;
    
    $password = '';
    
    for($i = 0 ; $i < $length; $i++){

        $password .= $makeArray[$i];
     
    }
     echo 'Your password = ' . $password;
?>

<br><br>
<html>
  <body>
      
    <button id = 'btn'>Click to change</button>
    
    <script>
        let btn = document.querySelector('#btn');
        btn.addEventListener('click',function(){

            window.location.reload();

        });
    
    </script>
    
    </body>
    
</html>

27. By AquaCoder

Made by AquaCoder. Simple 8 digit length password generator. Source

<?php
function password_generate($chars) 
{
  $data = '[email protected]#$%^&*';
  return substr(str_shuffle($data), 0, $chars);
}
  echo password_generate(7)." is your password.\n";
?>

28. By Sana Ullah

Made by Sana Ullah. It generates a password for the given length you can change the length by calling generate(10) with password length. Source

<?php

    function generate($length = 7){
        $alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        
        $password = array();
        $alphaLength = strlen($alphabets);
        $alphaLength--;
        
        for($ite = 0; $ite < $length; $ite++){
            $i = rand(0, $alphaLength);
            $password[] = $alphabets[$i];
        }
        
        return implode($password);
    }
    
    echo generate();
?>

29. By Ethan

Made by Ethan. The program generates 8 random passwords that are random in length. Source

<?php  
$letter = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo '<br />
<h1> or </h1>
<br />';
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
echo $letter[rand(0, 61)];
?>

30. By Sula Siwale

PHP Password Generator by Sula Siwale. It generates a 12 digit length random password. Source

<h1>Welcome To The Password Generator</h1>

<?php

    function password_gen($pslength=12)
    {
        $characters= "[email protected]#$%^&*()_+-<>?:;|";
        $password= substr(str_shuffle($characters), 0 , $pslength);
        return $password;
    }
    $psword=  password_gen();
   echo"Your new password is:  "  ."<b>{$psword}</b>";
 
   
?>