20 Random Alphanumeric Passwords
The passwords:
JWFvzXtKg9uZ8sCJKpkQ
tUQts7YVnrHmZxBSABNA
7aUvvhz8J7utq6KY4rJf
tHdxB4BffdcFp4E3tpH8
EcfARNWEMRd4oLSKRj8t
hz9mQtckC8wWpH26XBuy
sMUp4sYqRDGanAgpEv3c
rumvZDt8qWCrLTpURqau
ZvMjbHJaXfoAbm7rV6CX
A4Eep6xXpqGGKBM9KFmS
JPj4egZSdYYTTQbJnYuW
yZSba98uKw6jWsT3eScS
T3oJygCqm94XLaFTCPB9
HrVyPSytowsShoU3PRDx
TvSuBoPTmqBJKoMVPwhh
EzGcamp6aJt2VDN2eBKy
K3JP32vuXFyBVLrGNGfg
TEJAqnJNVVnW6Bmhw8XM
NDDvTRKnfMTCKhB4tQdc
aRBPpxdSKUEVYrK284Q2
The code for the class
<?php
/**
* Class PasswordGenerator
*/
class PasswordGenerator
{
public static $letters = "2346789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnopqrstuvwxyz";
public static $length = "20";
public $letters_array;
function __construct()
{
$this->letters_array = array();
for ($a = 0; $a < strlen(self::$letters); $a++) {
$this->letters_array[] = self::$letters[$a];
}
}
function make(): string
{
$password = '';
for ($i = 0; $i < self::$length; $i++) {
srand((float)microtime() * 10000000);
$password .= $this->letters_array[array_rand($this->letters_array)];
}
return $password;
}
function printOne()
{
print $this->make();
}
function printMany($num)
{
for ($i = 0; $i < $num; $i++) {
$this->printOne();
print "\n";
}
}
}
How to invoke the class
$PG = new PasswordGenerator();
$PG->printMany(20);