We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd44cdd commit 7d55694Copy full SHA for 7d55694
src/Util.php
@@ -898,6 +898,16 @@ public static function format_phone($input) {
898
return $input;
899
}
900
901
+ public static function format_ssn($input) {
902
+ $clean_input = substr(preg_replace('/\D+/i', '', $input), -9);
903
+ if (preg_match('/^(\d{3})(\d{2})(\d{4})$/', $clean_input, $matches)) {
904
+ $result = $matches[1].'-'.$matches[2].'-'.$matches[3];
905
+ return $result;
906
+ }
907
+
908
+ return $input;
909
910
911
/**
912
* Obtain a brand constant from a PAN
913
* https://stackoverflow.com/a/21617574/3685987
0 commit comments