I need to trim the last octet from an ip address using php. Basically I’m trying to just remove any digits after the third dot. I’m wondering if there is an out of the box solution for this? as my regex abilities are basic at best. Many thanks.
Share
or
or possibly
A more mathematical approach that doesn’t remove the last digit but rather replaces it with a 0: