tags:

views:

70

answers:

2

I want to hide the first 6 digits of social security I have them like 123-456-7890

I want to show ###-###-7890

how can I do that thanks

+8  A: 
$ssn = '123-456-7890';    
$ssn = '###-###-'.substr ($ssn , 8);
eyazici
or `'###-###'.substr($ssn,7)`. the dash will be there.
sreservoir
yay. no regex. -
webbiedave
+1  A: 

You can use the substr method to get the rightmost 4 characters from the SSN using a negative length:

$ssn = '111-222-4567';
$ssn_obscured = '###-###-' . substr($ssn, -4);

See http://us.php.net/substr for more information on the method.

JustJohn