note 25238 added to function.pow
| From: | paul+nospam at it dot ca | Date: | Mon, 16 Sep 2002 03:12:51 +0000 |
| Subject: | note 25238 added to function.pow | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36718@lists.php.net to get a copy of this message | ||
If you want to store IP addresses in a 4-byte field instead of a 15-byte field, you can convert
dotted-quads into integers. For example:
$requestip = 0;
foreach(explode('.',$_SERVER['REMOTE_ADDR']) as $mult => $quad)
$requestip += pow(256,(3-$mult))*$quad;
--
http://www.php.net/manual/en/function.pow.php
http://master.php.net/manage/user-notes.php?action=edit+25238
http://master.php.net/manage/user-notes.php?action=delete+25238
http://master.php.net/manage/user-notes.php?action=reject+25238