note 10510 added to long2ip

From: Date: Mon, 08 Jan 2001 16:56:45 +0000
Subject: note 10510 added to long2ip
Groups: php.notes 
Request: Send a blank email to php-notes+get-9478@lists.php.net to get a copy of this message
As shown under ip2long, the function returns signed integer. To use the number as an url, it is necessary to convert to unsigned integer. The function long2ip accepts both formats, unsigned and signed integer and produces the same result. Here is a test and good example: $ip = "192.168.100.25"; $l = ip2long($ip); echo "$l ==> " . long2ip($l); if($l < 0) $l += pow(2,32); echo "<br>"; echo "$l ==> " . long2ip($l); Hope this helpy somebody. Joerg More PHP: www.php.comzept.de (in german) http://www.php.net/manual/function.long2ip.php

« previous php.notes (#9478) next »