note 17290 deleted from function.long2ip by nlopess

From: Date: Fri, 13 Aug 2004 23:10:46 +0000
Subject: note 17290 deleted from function.long2ip by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74592@lists.php.net to get a copy of this message
Note Submitter: chris-phpmanual@bolt.cx ---- If you're stuck with php3, here's a php equivalent of the function: function mylong2ip($long) { if ($long > pow(2, 31)) $long -= pow(2, 32); $ip = array(); for ($i = 0; $i < 4; $i++) { $ip[] = $long >> (24 - ($i * 8)); $long -= $ip[$i] << (24 - ($i * 8)); if ($ip[$i] < 0) $ip[$i] += 256; } return join(".", $ip); }

« previous php.notes (#74592) next »