You can use $my_int = intval($string) or $my_int = (int)$string
But note that they will only work as desired on strings like "123" or strings starting with a numerical value.
intval("123 comes before 456") returns 123
however
intval("what comes after 123") returns 0 because leftmost character must be numerical.
Daniel