<?php
$input = 'hoge00';
$trials = 100000;
$tic = microtime(true);
for ($i = 0; $i < $trials; $i++) {
preg_match("/^[0-9]+$/", $input);
}
echo (string)(microtime(true) - $tic) . "\n";
$tic = microtime(true);
for ($i = 0; $i < $trials; $i++) {
ctype_digit($input);
}
echo (string)(microtime(true) - $tic) . "\n";