..
Serious Regular Expressions
$n = '[0-9]';
$reg = '/^[AZ]'.$n.$n.$n.$n.$n.$n.$n.$n.'$/';
if(preg_match($reg, $id)) {
// ...
}