Created
August 18, 2023 22:16
-
-
Save afilina/b1705f6c5db335c9756394b2a46d30ca to your computer and use it in GitHub Desktop.
Obfuscate an account number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$accountNumber = '222222222234'; | |
$revealLength = 4; | |
$obfuscationChar = '*'; | |
$obfuscatedAccountNumber = str_pad( | |
substr($accountNumber, -$revealLength, $revealLength), | |
strlen($accountNumber), | |
$obfuscationChar, | |
STR_PAD_LEFT | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment