src/Phone_number.php
public function find_phone_number_in_string($text = '', $region = NULL)
    {
        $inputParams = array(
            'text'   => $text,
            'region' => $region
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        if (empty($text)) {
            $this->debug->warning(__FUNCTION__, 'Text input is Empty!');

            return NULL;
        }
        try {
            $phoneNumberUtil    = PhoneNumberUtil::getInstance();
            $use_region         = NULL !== $region ? strtoupper($region) : self::DEFAULT_REGION;
            $phoneNumberMatcher = $phoneNumberUtil->findNumbers($text, $use_region);
            $result             = array();
            foreach ($phoneNumberMatcher as $phoneNumberMatch) {
                $result['number'][] = $phoneNumberMatch->number();
            }
            $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 find_phone_number_in_string($text = '', $region = NULL)
    {
        $inputParams = array(
            'text'   => $text,
            'region' => $region
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        if (empty($text)) {
            $this->debug->warning(__FUNCTION__, 'Text input is Empty!');

            return NULL;
        }
        try {
            $phoneNumberUtil    = PhoneNumberUtil::getInstance();
            $use_region         = NULL !== $region ? strtoupper($region) : self::DEFAULT_REGION;
            $phoneNumberMatcher = $phoneNumberUtil->findNumbers($text, $use_region);
            $result             = array();
            foreach ($phoneNumberMatcher as $phoneNumberMatch) {
                $result['number'][] = $phoneNumberMatch->number();
            }
            $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 find_phone_number_in_string
Returns an instance of PhoneNumberMatcher, which can be iterated over (returning PhoneNumberMatch objects).
It searches the input $text for phone numbers, using the $defaultRegion.
There are also optional parameters to set the phone number $leniency (look in Leniency for possible values),
and the $maxTries to search for the phone number.

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 10/9/18 14:51

@param string $text   Text String to Find
@param null   $region Region, example VN

@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 or Error (Set DEBUG to Details)