> $abytes = explode('.', $ip); // explode the IP string > $ip = 0; > foreach ($abytes as $byte) $ip = ($ip << 8) + $byte; > > This will give you the valid numeric equivalent of the IP address.
Isn't that what ip2long() does? Also, the man page on ip2long() has some good notes and code that may help the OP. http://www.php.net/manual/en/function.ip2long.php ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php