session_start();
echo $_SESSION['temparray'][] = generateCode();
var_dump($_SESSION['temparray']);
function generateCode(){
$code = strtoupper(substr(md5(crypt(uniqid(microtime()))), -5));
if(is_numeric($code)||in_array($code, $_SESSION['temparray'])){
return generateCode();
}
return $code;
}