note 115761 added to function.ip2long
| From: | KarlRixon | Date: | Thu, 18 Sep 2014 14:01:17 +0000 |
| Subject: | note 115761 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200481@lists.php.net to get a copy of this message | ||
The manual states that "ip2long() will also work with non-complete IP addresses", however
this is system-dependant so cannot be relied upon. For example, on my system ip2long() will return
FALSE for incomplete addresses:
<?php
var_dump(ip2long("255.255")); // bool(false)
?>
This is because ip2long will use inet_pton if available, which does not support non-complete
addresses. If inet_pton is not available on your system, inet_addr will be used and incomplete
addresses will work as stated.
----
Server IP: 113.20.13.217
Probable Submitter: 84.19.49.82
----
Manual Page -- http://php.net/manual/en/function.ip2long.php
Edit -- https://master.php.net/note/edit/115761
Del: integrated -- https://master.php.net/note/delete/115761/integrated
Del: useless -- https://master.php.net/note/delete/115761/useless
Del: bad code -- https://master.php.net/note/delete/115761/bad+code
Del: spam -- https://master.php.net/note/delete/115761/spam
Del: non-english -- https://master.php.net/note/delete/115761/non-english
Del: in docs -- https://master.php.net/note/delete/115761/in+docs
Del: other reasons-- https://master.php.net/note/delete/115761
Reject -- https://master.php.net/note/reject/115761
Search -- https://master.php.net/manage/user-notes.php