You may already know how to check IP v4 is in range using ip2long function, but it doesn’t support ipv6 so we have to find another way if we want to support ipv6 addresses as well. Here I wrote small function that will check ipv4 and ipv6 too.

Example: