I ran some benchmarks over the various methods suggested here, adding a few suggestions of my own - these are the timings for 100000 iterations of each method
int cast : 79.45ms
intval : 394.39ms
strtok : 428.85ms
preg_replace : 604.68ms
substr : 719.92ms
explode : 821.99ms
The int cast method wins by a mile, but as noted, you will strip off leading zeros. Intval is a slower method of achieving the same result.
A fast method to get the string with a leading zero is to use 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);