- substr: documentation ( source)
- str_shuffle: documentation ( source)
<?php
for($i = 0; $i <= 10; $i += 1) { //loop to calculate parameters for substr
$randcomb = str_shuffle('a0b1c2d3e4f5g6h7i8j9k0l!m@n#o$p%q^r&s*t(u)v_w-x=y+z[A}B]C|D/EFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}:|\<>?'); //creates a shuffled alphanumeric string
//$param1 = ($i+6) - 6; //this formula ensures all integers are positive and above zero
//$param2 = $param1 + 6; // this formula ensures all integers increment by 6 spaces
//if($param2 >= 60) { //since the second parameter goes over 60
// $param2 = ($param1 + 6) - 6; //subtract 6
//}
//$key = substr($randcomb, $param1, $param2); //generate random key
//echo $key."<BR>"; //display it for debugging
echo substr($randcomb, 0,6)."<BR>";
}