note 58388 added to function.ip2long
| From: | paulatsantasoftpointcom at osu1 dot php dot net | Date: | Wed, 02 Nov 2005 15:03:06 +0000 |
| Subject: | note 58388 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97989@lists.php.net to get a copy of this message | ||
to complement daevid at daevid dot com's note (11 Nov 2004) about the catch being that PHP
returns negative values....
If you define your mysql column that stores the ip address in INT format as signed (not unsigned),
then it'll work just fine.
No need to do any conversion using sprintf and this way you'll keep the value and be able to
use PHP's long2ip() function on the value and get an accurate result.
SO.. define your MySQL column as signed (leave the Attributes select box in phpMyAdmin blank) and
you won't need to do any conversions or whatnot.
----
Manual Page -- http://www.php.net/manual/en/function.ip2long.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58388
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58388&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58388&report=yes
Search -- http://master.php.net/manage/user-notes.php