How to display phone number in yii2 so that only the last 4 digits are displayed?
Hello, I have a gridview table, how to display phone numbers from db so that the last 4 digits are displayed in the client side .. Or should this be done with js?
It needs to be displayed like this:
+7 (123) *** - 34-56
The easiest way, put it in php
$tel = '+7(918)483-50-50';
$tel_array = str_split($tel);
$tel_array = $tel_array = $tel_array = '*';
$new_tel = implode($tel_array);
at the entrance you have a phone number in this format +7 (918) 483-50-50 '
at the exit you will receive +7 (918) *** - 50-50Anonymous
To place the code, please use CodePen or similar tool. Thanks you!