note 17290 added to function.long2ip

From: Date: Mon, 03 Dec 2001 14:59:15 +0000
Subject: note 17290 added to function.long2ip
Groups: php.notes 
Request: Send a blank email to php-notes+get-21563@lists.php.net to get a copy of this message
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); } -- http://www.php.net/manual/en/function.long2ip.php http://master.php.net/manage/user-notes.php?action=edit+17290 http://master.php.net/manage/user-notes.php?action=delete+17290 http://master.php.net/manage/user-notes.php?action=reject+17290

« previous php.notes (#21563) next »