i have stored two ip address values in two strings
a = '116.95.123.111'
b = '116.95.122.112'
i just want to compare the first two parts of ip address i.e 116.95 part in the two strings and as it is same in both the strings my comparison should return true. how to do this partial string comparison in PHP?
IP adresses can contain leading zeroes. When exploding, they can be compared to as integers, so that leading zeroes are ignored.
The “clean” way would be by something like this…