开发者

replacing first few digits with #

开发者 https://www.devze.com 2023-01-05 22:27 出处:网络
I want to hide t开发者_JAVA技巧he first 6 digits of social security I have them like 123-456-7890

I want to hide t开发者_JAVA技巧he first 6 digits of social security I have them like 123-456-7890

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

how can I do that thanks


$ssn = '123-456-7890';    
$ssn = '###-###-'.substr ($ssn , 8);


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消