This is a simple module to validate IP address, check IP address version, check if IP is within a range.

This started out as range_check but it does much more than just checking ranges but since it's already got a large amount of downloads (37,115 downloads in the last month as of this writing) I'll keep the name the same even though I kinda want to change it to something better.

This function is useful to get a consistent IP address such for storing it in a database or when searching in a database after being stored using this. So if a V6 address was sent compacted or not, or if you searched by either version this function would make sure you get a consistent IP address for both versions. Also the possibly of saving a few bytes.

If an V6 addressed mapped as v4 is given it will convert it to V4, If any other V6 address is given it is abbreviated and plain V4 addresses are left alone. Returns null if a invalid IP

This function is useful for displaying IP addresses, such as after grabbing it back from the database when using storeIP

If an V6 addressed mapped as v4 is given it will convert it to V4, If any other V6 address is given it is normalized into the longer version and plain V4 addresses are left alone. Returns a empty string if a invalid IP