src/Phone_number.php
public function vn_phone_number_old_and_new($phone_number = '', $phone_format = NULL)
    {
        $inputParams = array(
            'phone_number' => $phone_number,
            'phone_format' => $phone_format
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $old_number = $this->vn_convert_phone_number(trim($phone_number), 'old', $phone_format);
            $new_number = $this->vn_convert_phone_number(trim($phone_number), 'new', $phone_format);
            $this->debug->debug(__FUNCTION__, 'Old Number: ', $old_number);
            $this->debug->debug(__FUNCTION__, 'New Number: ', $new_number);
            if (!empty($old_number) && !empty($new_number)) {
                $result = array($old_number, $new_number);
                $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

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

            return array($phone_number);
        }

        return $phone_number;
    }
public function vn_phone_number_old_and_new($phone_number = '', $phone_format = NULL)
    {
        $inputParams = array(
            'phone_number' => $phone_number,
            'phone_format' => $phone_format
        );
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $old_number = $this->vn_convert_phone_number(trim($phone_number), 'old', $phone_format);
            $new_number = $this->vn_convert_phone_number(trim($phone_number), 'new', $phone_format);
            $this->debug->debug(__FUNCTION__, 'Old Number: ', $old_number);
            $this->debug->debug(__FUNCTION__, 'New Number: ', $new_number);
            if (!empty($old_number) && !empty($new_number)) {
                $result = array($old_number, $new_number);
                $this->debug->info(__FUNCTION__, 'Final Result: ', $result);

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

            return array($phone_number);
        }

        return $phone_number;
    }
public function vn_phone_number_old_and_new ( $ phone_number = '' , $ phone_format = NULL ) { $ inputParams = array ( 'phone_number' => $ phone_number , 'phone_format' => $ phone_format ) ; $ this -> debug -> info ( __FUNCTION__ , 'Input Params: ' , $ inputParams ) ; try { $ old_number = $ this -> vn_convert_phone_number ( trim ( $ phone_number ) , 'old' , $ phone_format ) ; $ new_number = $ this -> vn_convert_phone_number ( trim ( $ phone_number ) , 'new' , $ phone_format ) ; $ this -> debug -> debug ( __FUNCTION__ , 'Old Number: ' , $ old_number ) ; $ this -> debug -> debug ( __FUNCTION__ , 'New Number: ' , $ new_number ) ; if ( ! empty ( $ old_number ) && ! empty ( $ new_number ) ) { $ result = array ( $ old_number , $ new_number ) ; $ this -> debug -> info ( __FUNCTION__ , 'Final Result: ' , $ result ) ; return ( array ) $ result ; } if ( ! empty ( $ old_number ) && empty ( $ new_number ) ) { return array ( $ old_number ) ; } if ( ! empty ( $ new_number ) && empty ( $ old_number ) ) { return array ( $ new_number ) ; } } catch ( \ Exception $ e ) { $ message = 'Error File: ' . $ e -> getFile ( ) . ' - Line: ' . $ e -> getLine ( ) . ' - Code: ' . $ e -> getCode ( ) . ' - Message: ' . $ e -> getMessage ( ) ; $ this -> debug -> error ( __FUNCTION__ , $ message ) ; return array ( $ phone_number ) ; } return $ phone_number ; }
Function vn_phone_number_old_and_new
Get Data Phone Number Old and New Convert
Lấy về Data Phone Number dạng cũ và mới, dữ liệu trả về dạng Array

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

@param string $phone_number Phone Number Input
@param null   $phone_format Method to Format VN, VN_HUMAN, E164, INTERNATIONAL, NATIONAL, RFC3966, HIDDEN,
HIDDEN_HEAD, HIDDEN_MIDDLE, HIDDEN_END

@see   https://github.com/nguyenanhung/vn-telco-phonenumber/blob/master/test_phone_number.php

@return array|null|string Array if Success, Null if Error
Function vn_phone_number_old_and_new Get Data Phone Number Old and New Convert Lấy về Data Phone Number dạng cũ và mới dữ liệu trả về dạng Array