Skip to Content

phone_format()

Format phone numbers into the preferred (315) 478-6700 format.

PHP April 26, 2017

Usage

PHP
nebula()->phone_format($number)

Parameters

$number
(Required) (String) The number to format
Default: None

Request or provide clarification »

Source File

Located in /libs/Utilities/Utilities.php on line 172.

No Hooks

This function does not have any filters or actions available. Request one?
PHP
        public function phone_format($number=false){
            if ( !empty($number) ){
                return preg_replace('~.*(\d{3})[^\d]{0,7}(\d{3})[^\d]{0,7}(\d{4}).*~', '($1) $2-$3', $number);
            }
            return $number;
        }

Override

This function can not be short-circuited with an override filter. Request one?