Я провел несколько тестов по различным методам, предложенным здесь, добавив несколько собственных предложений - это время для 100000 итераций каждого метода
int cast : 79.45ms
intval : 394.39ms
strtok : 428.85ms
preg_replace : 604.68ms
substr : 719.92ms
explode : 821.99ms
Метод int cast побеждает на милю, но, как уже было отмечено, вы удаляете лидирующие нули. Intval - более медленный метод достижения того же результата.
Быстрый способ получить строку с в начале нуля - использовать strtok ($ str, '_');
$str="154_timestamp";
$c=100000;
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n=(int)$str;
printf("int cast : %0.2fms\n", (microtime(true)-$s)*1000);
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n = current(explode("_", $str));
printf("explode : %0.2fms\n", (microtime(true)-$s)*1000);
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n = substr($str, 0, strpos($str, '_'));
printf("substr : %0.2fms\n", (microtime(true)-$s)*1000);
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n = strtok($str, '_');
printf("strtok : %0.2fms\n", (microtime(true)-$s)*1000);
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n = intval($str);
printf("intval : %0.2fms\n", (microtime(true)-$s)*1000);
$s=microtime(true);
for ($x=0; $x<$c; $x++)
$n = preg_replace("/_[^_]+$/",'',$str);
printf("preg_replace : %0.2fms\n", (microtime(true)-$s)*1000);