If you want to verify whether or not a variable contains only digits, you can type cast it to a string and back to int and see if the result is identical. Like so:
<?php
// (bool) TRUE if only digits, FALSE otherwise
$isOnlyDigits = (string) (int) $input === (string) $input;
?>
I haven't benchmarked it, but I'm guessing it's significantly faster then regular expressions.