|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-12-13 06:35 UTC] stas@php.net
[2003-01-18 10:27 UTC] moriyoshi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon May 25 08:00:02 2026 UTC |
Feed the following list to this script and you will see how long2ip screws up. There is an overflow condition it seems: 178519801 1061963075 1070665698 1070668067 2180645450 2180645574 2180645666 2180645722 2180647266 2180648705 2180649062 2180652350 2180676205 2301042637 2554268534 2554278550 2554279006 3232238083 3232238334 3435825182 3435825736 3475085569 3506496261 3508072161 3522432302 3528459286 3528470646 3528471070 <?php function lng2ip($ip) { settype($ip,"double"); return floor($ip/(256*256*256)) . "." . floor($ip/(256*256))%256 . "." . floor($ip/256)%256 . "." . } $fh=fopen("xx","r"); while ($x=fgets($fh,100)) { $x=rtrim ($x); echo "$x ".long2ip($x)." ".lng2ip($x)."\n"; } ?>