I need to hide part of the URL through a PHP
script.
The URL can have unlimited levels, subdomains and characters, whose TLD can have one or more levels, for example:
It can be health.blog.web.com.br
or just site.net
.
Since it is stored in the $website
variable, I thought about getting the number of characters in the variable, divide by 2, and in the first part get the last three characters replaced with an asterisk (*).
Already in the second part get the first three characters and also replace with asterisk. Thus, based on the examples above, it would have health.b******b.com.br
and s******t
.
Is it possible to split the variable and add the 6 asterisks?
Note: the value of the $ website variable is given by the user, and can be from 4 to N characters.