Skip to content

Commit 188ce0b

Browse files
committed
formatEin()
1 parent c7f4d74 commit 188ce0b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Util.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,16 @@ public static function formatPhone($input, $country_code = 1, $format = '+%1$s (
823823
return $input;
824824
}
825825

826+
public static function formatEin($input) {
827+
$clean_input = substr(preg_replace('/\D+/i', '', $input), -9);
828+
if (preg_match('/^(\d{2})(\d{7})$/', $clean_input, $matches)) {
829+
$result = $matches[1].'-'.$matches[2];
830+
return $result;
831+
}
832+
833+
return $input;
834+
}
835+
826836
public static function formatSsn($input) {
827837
$clean_input = substr(preg_replace('/\D+/i', '', $input), -9);
828838
if (preg_match('/^(\d{3})(\d{2})(\d{4})$/', $clean_input, $matches)) {

0 commit comments

Comments
 (0)