Answer the question
In order to leave comments, you need to log in
How to replace characters with an asterisk in a string?
There is a code:
5959067ca46f67b671340d6472fe046662fb8nc5cd338f0e449563b93a330f3ca6fe2d7m812875b473fae
5959********3fae
Answer the question
In order to leave comments, you need to log in
as an option
$str = '5959067ca46f67b671340d6472fe046662fb8nc5cd338f0e449563b93a330f3ca6fe2d7m812875b473fae';
$new_str = mb_substr($str, 4) . '********' . mb_substr($str, -4);
$new_str = substr($str, 0, 4) . '********' . substr($str, -4);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question