指定した文字数分の後ろだけそのままで、残りをマスキング
private function maskString($string, $keepLength=3):string {
return "xxxxxx" . substr($string, -1 * ($keepLength));
}
// xxxxxxHI
$maskText = maskString("ABCDEFGHI",2);
Go to list of users who liked
指定した文字数分の後ろだけそのままで、残りをマスキング
private function maskString($string, $keepLength=3):string {
return "xxxxxx" . substr($string, -1 * ($keepLength));
}
// xxxxxxHI
$maskText = maskString("ABCDEFGHI",2);
Register as a new user and use Qiita more conveniently
Go to list of users who liked