85.124.99.2
How can I hide the last two numbers from the IP?
and make it like:
86.124.xxx.xxx
Wrote this quickly
$ip = "85.124.99.2";
$parts = explode('.',$ip);
$new_ip = $parts[0].'.'.$parts[1].'.xxx.xxx';
Warning: You should test the length of parts before accessing $parts[n]
$ip = preg_replace('/\.\d+\.\d+$/', '.xxx.xxx', $ip);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With