On Wed, Jun 23, 2010 at 6:01 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> That's what I'd use. You may also have to wrap it inside an abs() call
> to ensure it's a positive number, as some IP addresses equate to
> negative with ip2long().

NO NO NO NO NO!!!!

<?php

$x = ip2long('192.168.0.1');
var_dump($x);
// int(-1062731775)

var_dump(long2ip($x));
// string(11) "192.168.0.1"

var_dump(long2ip(abs($x)));
// string(13) "63.87.255.255"

?>

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to