In general, you don't need to convert numbers to strings or vice
versa. PHP is usually able to figure out what is needed from the
context.
To see if a variable is numeric, you can use is_int() or one of the
similar functions; but you might prefer a regular expression as this
allows you to specify the exact number of digits you wish to allow,
e.g.:
if (ereg('[0-9]{1,5}$', $var))
will ensure that $var contains 1 to 5 digits and nothing else.