Hello,
Please have a look at
this tutorial[
^]. The tutorial will show you how a PHP page can be made to get contact information from the user validate it and re-display.
For a simple non web scenario following snippet should suffice.
<?php
$strVal = getInput("Please input a phone number : ");
if (isset($strVal)) {
$l = strlen($strVal);
$strPhone = substr($strVal, 0, ($l - 4)) . "****";
echo "Masked Number is : " . $strPhone;
}
function getInput($msg){
fwrite(STDOUT, "$msg: ");
$varin = trim(fgets(STDIN));
return $varin;
}
?>
Regards,