Here is the 5 chars version.
But be aware you probably can not run it.
Because it takes at average 5 minutes to crack 5 letter passwords.
You can of course increase the PHP.ini 'max execution time', if you wish.
Set it at 900 seconds = 15 minutes, to be fairly sure it works.
<?php
// 8 chars excluded: "&'<>\` and space
$symbol = '!#$%()*+,-./:;=?@[]^_{|}~'; // 25 chars
$number = '0123456789'; // 10 chars
$upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // 26 chars
$lower = 'abcdefghijklmnopqrstuvwxyz'; // 26 chars
$alfa = $upper.$lower; // 52 chars
$chars = $symbol.$number.$upper.$lower;// 87 chars
// 5 characters password generator
$pw = '';
$pw[0] = $chars[mt_rand(0,86)];
$pw[1] = $chars[mt_rand(0,86)];
$pw[2] = $chars[mt_rand(0,86)];
$pw[3] = $chars[mt_rand(0,86)];
$pw[4] = $chars[mt_rand(0,86)];
echo '<p style="font-family:\'Courier New\'">';
echo $pw;
echo '<br>';
$ck = '';
for($a=32; $a<127; $a++) {
$ck[0] = chr($a);
for($b=32; $b<127; $b++) {
$ck[1] = chr($b);
for($c=32; $c<127; $c++) {
$ck[2] = chr($c);
for($d=32; $d<127; $d++) {
$ck[3] = chr($d);
for($e=32; $e<127; $e++) {
$ck[4] = chr($e);
if($ck == $pw) {
break(5);
}
}
}
}
}
}
echo $ck;
exit();