I have a social security number that looks like this:
1234567890
I want to show it as follows:
###-##-7890
So, basically, masking the first five digits and entering hyphens.
How can i do this? Thank.
$number = '###-##-'.substr($ssn, -4);
just make the start part a string and concat that with the last 4 digits. Either this, or do it in the request itself, asSELECT CONCAT('###-##-', RIGHT(ssn, 4)) FROM customer...
SELECT CONCAT('###-##-', RIGHT(ssn, 4)) FROM customer...
This will take the last 4 numbers and mask the rest:
$number = "1234567890"; $number = "###-##-" . substr($number, -4);
$ssno = substr_replace($ssno, '#####-', 0, 6);
$number = "1234567890"; $number = "###-##-".$number[7].$number[8].$number[9].$number[10];
Source: https://habr.com/ru/post/1753424/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1753419/using-c-macros-to-check-for-variable-existence&usg=ALkJrhj82oDDyUDbxT_xB_nzG9drDpoZLAGetting Java source code from a class name - javaОтладка под Linux: существует ли реализация псевдослучайного циклического буфера? - debuggingXHTML - adding new elements - htmlHow to execute a very long dynamic SQL query? - sql-serverзаменяя первые несколько цифр на # - phpBrowser (free to use) SSH - asp.netLoop in R to create and save a series of ggplot2 graphs with the specified names - loopsColdFusion 9 Upgrade: Illegal jump target or branch - coldfusionCustom subdomains in the Sinatra app - ruby | fooobar.comAll Articles