Skip to Content
Menu

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 »

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

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

    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?