I am having trouble censoring the last octet of an IP address.
If I have the IP 168.251.436.255 I need it to end up like 168.251.436.*** or something similar.
I also need to have it do the same thing if I have an IP like 40.255.130.79 and I need it to end up like 40.255.130.***.
Censor last octet of an IP Address
Moderator: General Moderators
Re: Censor last octet of an IP Address
Code: Select all
$censored_ip = substr($ip, - strrpos($ip, '.')).'.***';Re: Censor last octet of an IP Address
Cool, thanks.
Re: Censor last octet of an IP Address
It reverses the IP in a weird way.
68.174.59.134 ----> 74.59.134.***
68.174.59.134 ----> 74.59.134.***
Re: Censor last octet of an IP Address
Code: Select all
substr($ip, 0, strrpos($ip, '.')).'.***';There are 10 types of people in this world, those who understand binary and those who don't
Re: Censor last octet of an IP Address
Thanks, it works now.