How to Hide numbers of a Phone Number using PHP

In this tutorial, we will show you how to hide mobile numbers using PHP. Many PHP project needs this type of specialty. I want to display mobile numbers from the database and we want to show only some digits of a mobile number.

Replace some characters with Asterisks in PHP using. we are using a substr function to replace characters.

PHP Code

<?php
    $number = '1234567890';
    echo  substr($number, 0, 0) . '********' . substr($number,  8);
?>

Output

********90

And if you like this tutorial please share it with your friends on social media.

Leave a Reply

Your email address will not be published. Required fields are marked *