Using Php to Hide Important Information
The title might be a little silly :) but in some web sites when we add our phone number we can see only first 2 digit and last 2 digit. Rest of the numbers are filtered as ****
Today i prepared a function because i needed in my project.
<?php
function privateStr($str, $start, $end){
$after = mb_substr($str, 0, $start, 'utf8');
$repeat = str_repeat('*', $end);
$before = mb_substr($str, ($start + $end), strlen($str), 'utf8');
return $after.$repeat.$before;
}
Usage is like this ;
<?php
$number = '09856584785';
echo privateStr($number , 3, 5); // Result: 098*****785
In this way, showing the just only one part of private parts you hide the important information parts from others.
Comments
Popular Articles
Popular Tags
- #directive
- #Function
- #React
- #Class
- #centOS
- #Json
- #Text
- #API
- #URL
- #Encrypting
- #Redirect
- #Form
- #Special Characters
- #Special
- #Random
- #Generating
- #SASS
- #Version
- #Installation
- #Show
- #
- #Ajax
- #method
- #Logic For Displaying Posts
- #Key
- #DDOS
- #Default Value
- #Comment Line
- #1364 Field
- #Error
- #Abbreviation
- #QR Code Generating
- #Date
- #timeAgo
- #cURL
- #Array
- #Arrays with Key Values to String Statement
- #Short Tag
- #Vite
- #Reading Excel Files
- #Activate
- #Reading
- #Composer
- #Autoloader
- #PSR-4
- #Insert
- #Record
- #Real Time
- #Characters
- #Socket.io
There are no comments, make the firs comment