NYCPHP Meetup

NYPHP.org

[nycphp-talk] I need a function that will compare IP addresses

Hans Zaunere hans at nyphp.org
Mon Aug 18 12:48:20 EDT 2003



Phil Powell wrote:

>  have written a function that is supposed to compare the first three 
> nodes of an IP address, but it is riddled with errors that I have given 
> up trying to figure out.
>  
> Is there an existing function out there that can do this? I want to 
> compare "127.0.0.1" with "127.0.0.100" and come with as a "match", or 
> "127.0.0.1" with "127.0.0.1", but no "match if "127.0.0.1" and 
> "127.255.0.0".

IPs are really just long ints.

This should take care of things:

http://us4.php.net/ip2long


H




More information about the talk mailing list