nah - there's an easy peasy way to do this - use php's type juggling or type casting to fix a variable to a certain type
//$foo is a string
$foo = "123bar";
$foo = (int) $foo;
echo $foo;
//echos 123, as $foo has been cast to an integer
i spend my free time reading man pages! sad, i know