src/Phone_number.php
public function get_region_codes_for_country_code($region_codes = NULL)
    {
        $inputParams = array('region_codes' => $region_codes);
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $phoneNumberUtil = PhoneNumberUtil::getInstance();
            $use_region_code = NULL !== $region_codes ? trim($region_codes) : self::DEFAULT_REGION_CODE;
            $result          = $phoneNumberUtil->getRegionCodesForCountryCode($use_region_code);
            $this->debug->debug(__FUNCTION__, 'Use REGION Code: ' . $use_region_code);
            $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
public function get_region_codes_for_country_code($region_codes = NULL)
    {
        $inputParams = array('region_codes' => $region_codes);
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $phoneNumberUtil = PhoneNumberUtil::getInstance();
            $use_region_code = NULL !== $region_codes ? trim($region_codes) : self::DEFAULT_REGION_CODE;
            $result          = $phoneNumberUtil->getRegionCodesForCountryCode($use_region_code);
            $this->debug->debug(__FUNCTION__, 'Use REGION Code: ' . $use_region_code);
            $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
public function get_region_codes_for_country_code ( $ region_codes = NULL ) { $ inputParams = array ( 'region_codes' => $ region_codes ) ; $ this -> debug -> info ( __FUNCTION__ , 'Input Params: ' , $ inputParams ) ; try { $ phoneNumberUtil = PhoneNumberUtil :: getInstance ( ) ; $ use_region_code = NULL !== $ region_codes ? trim ( $ region_codes ) : self :: DEFAULT_REGION_CODE ; $ result = $ phoneNumberUtil -> getRegionCodesForCountryCode ( $ use_region_code ) ; $ this -> debug -> debug ( __FUNCTION__ , 'Use REGION Code: ' . $ use_region_code ) ; $ this -> debug -> info ( __FUNCTION__ , 'Final Result: ' , $ result ) ; return $ result ; } catch ( \ Exception $ e ) { $ message = 'Error File: ' . $ e -> getFile ( ) . ' - Line: ' . $ e -> getLine ( ) . ' - Code: ' . $ e -> getCode ( ) . ' - Message: ' . $ e -> getMessage ( ) ; $ this -> debug -> error ( __FUNCTION__ , $ message ) ; return NULL ; } }
Function get_region_codes_for_country_code
Returns a list of region codes that match the $region_codes.
For a non-geographical country calling codes, the region code 001 is returned.

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 9/21/18 02:18

@param null $region_codes example 84

@see   https://github.com/nguyenanhung/vn-telco-phonenumber/blob/master/test_phone_number.php
@see   https://github.com/giggsey/libphonenumber-for-php/blob/master/docs/PhoneNumberUtil.md

@return array|mixed|null Array if success, null if not
Function get_region_codes_for_country_code Returns a list of region codes that match the $region_codes . For a non - geographical country calling codes the region code 001 is returned .