How to partially hide phone number in php?

This post is focused on partially hide phone in php. We will look at example of hide phone number php.

1. Code:

<?php
function hide_mobile_no($number){
    return substr($number, 0, 2) . '******' . substr($number, -2);
}

$number = 0989889916 ;
echo hide_mobile_no($number) ;

?>

2. Example:

Input:

Input:  0989889916 

Output:

Output: 09******16