if you want to take a number from a string, no matter what it may contain, here is a good solution:
<?php
function int($s){return(int)preg_replace('/[^\-\d]*(\-?\d*).*/','$1',$s);}
echo int('j18ugj9hu0gj5hg');
?>
this example returns an int, so it will follow the int rules, and has support for negative values.
<?php
function int($s){return($a=preg_replace('/[^\-\d]*(\-?\d*).*/','$1',$s))?$a:'0';}
echo int('j-1809809808908099878758765ugj9hu0gj5hg');
?>
this one returns a string with just the numeric value.
it also supports negative values.
the latter is better when you have a 32 bit system and you want a huge int that is higher than PHP_MAX_INT.