20 Random Alphanumeric Passwords
The passwords:
u7ZvfoGRM8pKsJzco2qx
Qc8dwSRVRaGVspGWtxZK
rMSwkxfFapWoZaSMgCAB
eMAoYeJ49PyhgMu6rzBs
KrXQgcYu2nW64tszHeuj
tLJXVaehheKRzmSwR7v7
2Dq6mFQ9zZM8hL3rkLFq
JCY9RRmkS7puWgd28PbC
yufLQNARewwV88pQFQUg
WRWNTEJyEy3ptdNhXAgD
t6a9GyzxG7XH8gATcPyK
Nez7KmEaqjVUe9H9ngyM
t6sBGESFXvPTDXko7HG6
nqmjxrab3LF7Nbvs3fCa
BMNFB6ukKEpfdgvts7hS
a4CPQZqDsCB3NgforRbq
DbPFMcs6xnHSTMEGoALp
8DUTVq29mnrzWrwewLvJ
GgyuD37DW69GeER6EJkV
LL6KrHZpTjK8YHaAxP2o
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);