add method to format phones
This commit is contained in:
parent
f14a4fa67c
commit
2031165afc
@ -61,4 +61,12 @@ class Libs
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function Phone(string $phone): string
|
||||
{
|
||||
$phone = preg_replace('/[^0-9]/', '', $phone);
|
||||
if(strlen($phone) > 10 && substr($phone, 0, 1) == '1') {
|
||||
$phone = substr($phone, 1);
|
||||
}
|
||||
return $phone;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user