I've been using this to gender a random 12 character string:
// lost-in-code.com/programming/php-code/php-random-string-with-numbers-and-letters
$ch = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@$%^&(){}[]+=-_/?|*#";
$sc = "";
for ($p = 0; $p < 12; $p++) {
$sc .= $ch[mt_rand(0,82)]; // 83 is the strlen of characters
}
It turns out that it in practice it can include a space in the string. This was not expected!
Why would it be? Does it treat the underscore as a space? It's been causing random (and until now, untraceable) bugs.
Thanks.
$chis not an array and space is not included in$ch. Um...$string[3]maps to specific characters in a string.