Hiding part of a URL website stored in a PHP variable

0

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.     

asked by anonymous 26.04.2017 / 20:58

1 answer

0

So?

$url = explode('.', 'meu.site.meu.com.br');
$url[1] = '*';
$url = implode ('.', $url);
    
27.04.2017 / 19:31