You just have to create a list of characters
[1] [2] and select it randomly.
code:
<?php
$charlist = (array_merge(
range('0', '9'),
range('a', 'z'),
range('A', 'Z')
));
function pick_a_character() {
global $charlist;
return $charlist[rand(0, count($charlist) - 1)];
}
function create_code($length) {
$o = '';
for ($i = 0; $i < $length; $i ++)
$o .= pick_a_character();
return $o;
}
$code = create_code(12);
echo "The code is $code";
?>