note 78643 added to function.ip2long
| From: | ironiridisatgmaildotcom at osu1 dot php dot net | Date: | Sun, 21 Oct 2007 06:54:57 +0000 |
| Subject: | note 78643 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131592@lists.php.net to get a copy of this message | ||
Keep in mind that storing IP addresses inside of your database as integers (rather than 15 character
strings in decimal format, or 8 character strings in hex format) is hundreds of times faster.
Take the typical case of a MySQL database doing a search for an IP address on thousands (or
millions!) of rows; you're either doing a string compare for each entry, or an integer
equation. If you do your indexes correctly, your lookups should be literally 100x faster using an
INT rather than a VARCHAR.
Also note that an integer doesn't need to be escaped when passed to a database. :)
----
Server IP: 69.147.83.197
Probable Submitter: 71.63.245.65
----
Manual Page -- http://www.php.net/manual/en/function.ip2long.php
Edit -- https://master.php.net/note/edit/78643
Del: integrated -- https://master.php.net/note/delete/78643/integrated
Del: useless -- https://master.php.net/note/delete/78643/useless
Del: bad code -- https://master.php.net/note/delete/78643/bad+code
Del: spam -- https://master.php.net/note/delete/78643/spam
Del: non-english -- https://master.php.net/note/delete/78643/non-english
Del: in docs -- https://master.php.net/note/delete/78643/in+docs
Del: other reasons-- https://master.php.net/note/delete/78643
Reject -- https://master.php.net/note/reject/78643
Search -- https://master.php.net/manage/user-notes.php