I have a Social Security number showing up like this:
1234567890
I want to show it like this:
###-##-7890
So, basically, masking the first five digits and entering hyphens.
How can I do that? Thanks.
$number = '###-##-'.substr($ssn, -4);
just make the starting part a string and concat that with the last 4 digits. Either that or do it in the query itself like SELECT CONCAT('###-##-', RIGHT(ssn, 4)) FROM customer...
This will take the last 4 numbers and mask the rest:
$number = "1234567890";
$number = "###-##-" . substr($number, -4);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With