Skip to content

Instantly share code, notes, and snippets.

@zhooravell
Created March 7, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhooravell/fe19695ee66cf96ee1b1ef6978b58413 to your computer and use it in GitHub Desktop.
Save zhooravell/fe19695ee66cf96ee1b1ef6978b58413 to your computer and use it in GitHub Desktop.
function getMaskedNumber($creditCardNumber, $maskingCharacter = '*')
{
$head = substr($creditCardNumber, 0 ,6);
$tail = substr($creditCardNumber, -4);
$middle = str_repeat($maskingCharacter, 4);
return $head.$middle.$tail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment