How to hide Phone number in PHP with different format?

How to hide phone number in PHP.

I am using phone number in pp but i want a function in which i can add star in my phone number so can user can not read a phone number only some number will be visible and some number will be with asterisk.

So i created a function in which i have added a code. You can just change the logic and change the format of phone number to hide the number.

function stars($phone) {

$times=strlen(trim(substr($phone,4,5)));
$star ='';
for ($i=0; $i <$times ; $i++) { 
$star.='*';
}
return $star;
}

// 99******54 above function will print a number like this

Comments