public static function phone($value, $format) {
        $value = preg_replace('/[^0-9]+/', '', $value);

        if (is_array($format)) {
            $length = mb_strlen($value);

            if ($length >= 11) {
                $format = $format[11];
            } else if ($length >= 10) {
                $format = $format[10];
            } else {
                $format = $format[7];
            }
        }

        return static::format($value, $format);
    }
public static function phone($value, $format) {
        $value = preg_replace('/[^0-9]+/', '', $value);

        if (is_array($format)) {
            $length = mb_strlen($value);

            if ($length >= 11) {
                $format = $format[11];
            } else if ($length >= 10) {
                $format = $format[10];
            } else {
                $format = $format[7];
            }
        }

        return static::format($value, $format);
    }
public static function phone ( $ value , $ format ) { $ value = preg_replace ( '/[^0-9]+/' , '' , $ value ) ; if ( is_array ( $ format ) ) { $ length = mb_strlen ( $ value ) ; if ( $ length >= 11 ) { $ format = $ format [ 11 ] ; } else if ( $ length >= 10 ) { $ format = $ format [ 10 ] ; } else { $ format = $ format [ 7 ] ; } } return static :: format ( $ value , $ format ) ; }
Format a phone number. A phone number can support multiple variations,
depending on how many numbers are present.

@param int $value
@param string $format
@return string
Format a phone number . A phone number can support multiple variations depending on how many numbers are present .