Indeed it's quite simple:
if ((strlen($number)==12) && (is_numeric($number)))
{
yup, it's a 12 digit number
};
and the advanced way, using regular expressions:
if (preg_match("/[0-9]{12}$/",$number))
{
#yup, 12 digit numeric
};
That probably looks like greek to a newbie, and that makes me feel all superior :-)
Let me know if you'd like me to explain it. The first method should work just fine for you.