Use a regular expression with ereg :
For example, a test script :
$s = "123456";
$numbersOnly = !ereg("[^0-9]",$s);
if ($numbersOnly) {
echo "There are only numbers in '$s' !<br/>";
} else {
echo "'$s' has non-numbers in it !<br/>";
}
The regular expression "[0-9]" matches any string that has at least one non numeric character in it (" put in front of a character set is the negation of that set).
ereg is simply a PHP wrapper for regexps.