From Sagar, 6 Years ago, written in PHP.
Embed
  1. <?php
  2. function randomPassword() {
  3.     $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
  4.     $pass = array(); //remember to declare $pass as an array
  5.     $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
  6.     for ($i = 0; $i < 8; $i++) {
  7.         $n = rand(0, $alphaLength);
  8.         $pass[] = $alphabet[$n];
  9.     }
  10.     return implode($pass); //turn the array into a string
  11. }
  12.  
  13. echo randomPassword();
  14. ?>

Replies to Random Password Generator php rss

Title Name Language When
Re: Random Password Generator php Guest php 11 Months ago.