Skip to content

Commit 5eebc54

Browse files
authored
fixes #1
added `$country_code` parameter to `format_phone` fixes #1
1 parent ebafa27 commit 5eebc54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Util.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,10 @@ public static function unzip($zip_file, $extract_path = null) {
888888
} return false;
889889
}
890890

891-
public static function format_phone($input) {
891+
public static function format_phone($input, $country_code = 1) {
892892
$clean_input = substr(preg_replace('/\D+/i', '', $input), -10);
893893
if (preg_match('/^(\d{3})(\d{3})(\d{4})$/', $clean_input, $matches)) {
894-
$result = '+1 ('.$matches[1].') '.$matches[2].'-'.$matches[3];
894+
$result = '+'.$country_code.' ('.$matches[1].') '.$matches[2].'-'.$matches[3];
895895
return $result;
896896
}
897897

0 commit comments

Comments
 (0)