PHP convert to float or int code example Example 1: php string to int intval($string); Example 2: php float to int $int = intval($float);