I did this to create a random 8-digit password for users:
$characters = array( "A","B","C","D","E","F","G","H","J","K","L","M", "N","P","Q","R","S","T","U","V","W","X","Y","Z", "a","b","c","d","e","f","g","h","i","j","k","m", "n","p","q","r","s","t","u","v","w","x","y","z", "1","2","3","4","5","6","7","8","9"); for( $i=0;$i<=8;++$i ){ shuffle( $characters ); $new_pass .= $characters[0]; }