How to Hide numbers of a Phone Number using PHP

In this tutorial, we will show you how to hide mobile number 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 digit of a mobile number.

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

You may also like How to check validation URL www and href in PHP and How to PHP Validate URL.

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 *