src/PhoneNumberUtil.php
public function extractCountryCode($fullNumber, &$nationalNumber)
    {
        if ((mb_strlen($fullNumber) == 0) || ($fullNumber[0] == '0')) {
            // Country codes do not begin with a '0'.
            return 0;
        }
        $numberLength = mb_strlen($fullNumber);
        for ($i = 1; $i <= static::MAX_LENGTH_COUNTRY_CODE && $i <= $numberLength; $i++) {
            $potentialCountryCode = (int)substr($fullNumber, 0, $i);
            if (isset($this->countryCallingCodeToRegionCodeMap[$potentialCountryCode])) {
                $nationalNumber .= substr($fullNumber, $i);
                return $potentialCountryCode;
            }
        }
        return 0;
    }
public function extractCountryCode($fullNumber, &$nationalNumber)
    {
        if ((mb_strlen($fullNumber) == 0) || ($fullNumber[0] == '0')) {
            // Country codes do not begin with a '0'.
            return 0;
        }
        $numberLength = mb_strlen($fullNumber);
        for ($i = 1; $i <= static::MAX_LENGTH_COUNTRY_CODE && $i <= $numberLength; $i++) {
            $potentialCountryCode = (int)substr($fullNumber, 0, $i);
            if (isset($this->countryCallingCodeToRegionCodeMap[$potentialCountryCode])) {
                $nationalNumber .= substr($fullNumber, $i);
                return $potentialCountryCode;
            }
        }
        return 0;
    }
public function extractCountryCode ( $ fullNumber , & $ nationalNumber ) { if ( ( mb_strlen ( $ fullNumber ) == 0 ) || ( $ fullNumber [ 0 ] == '0' ) ) { // Country codes do not begin with a '0'. return 0 ; } $ numberLength = mb_strlen ( $ fullNumber ) ; for ( $ i = 1 ; $ i <= static :: MAX_LENGTH_COUNTRY_CODE && $ i <= $ numberLength ; $ i ++ ) { $ potentialCountryCode = ( int ) substr ( $ fullNumber , 0 , $ i ) ; if ( isset ( $ this -> countryCallingCodeToRegionCodeMap [ $ potentialCountryCode ] ) ) { $ nationalNumber .= substr ( $ fullNumber , $ i ) ; return $ potentialCountryCode ; } } return 0 ; }
Extracts country calling code from fullNumber, returns it and places the remaining number in  nationalNumber.
It assumes that the leading plus sign or IDD has already been removed.
Returns 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber unmodified.
@param string $fullNumber
@param string $nationalNumber
@return int
@internal
Extracts country calling code from fullNumber returns it and places the remaining number in nationalNumber . It assumes that the leading plus sign or IDD has already been removed . Returns 0 if fullNumber doesn t start with a valid country calling code and leaves nationalNumber unmodified .