use ctype_digit but, for a positive number, you need to add the "> 0" check
if (isset($_GET['p']) && ctype_digit($_GET['p']) && ($_GET['p'] > 0))
{
// the get input contains a positive number and is safe
}
in general, use ctype_digit in this way
if (ctype_digit((string)$var))
to prevent errors