add method to format phones

This commit is contained in:
Ryan Prather 2025-01-05 06:10:22 +00:00
parent f14a4fa67c
commit 2031165afc

View File

@ -61,4 +61,12 @@ class Libs
return null; 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;
}
} }