note 125978 added to function.long2ip
| From: | Rolf@php.net | Date: | Fri, 02 Apr 2021 15:53:41 +0000 |
| Subject: | note 125978 added to function.long2ip | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219174@lists.php.net to get a copy of this message | ||
an Anonymous wrote several years ago that you should cast the parameter to float to make sure that
you get the right result on 32-bit machines. That probably never worked.
But the idea is on a good track: to convert a bitstring into an ip, use
$ip = long2ip((int)bindec($bits));
This works on 32- and 64-bit machines.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 2a0a:a540:a8e1:0:a1a1:47f:50f4:af39)
----
Manual Page -- http://php.net/manual/en/function.long2ip.php
Edit -- https://master.php.net/note/edit/125978
Del: integrated -- https://master.php.net/note/delete/125978/integrated
Del: useless -- https://master.php.net/note/delete/125978/useless
Del: bad code -- https://master.php.net/note/delete/125978/bad+code
Del: spam -- https://master.php.net/note/delete/125978/spam
Del: non-english -- https://master.php.net/note/delete/125978/non-english
Del: in docs -- https://master.php.net/note/delete/125978/in+docs
Del: other reasons-- https://master.php.net/note/delete/125978
Reject -- https://master.php.net/note/reject/125978
Search -- https://master.php.net/manage/user-notes.php