|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-01 15:36 UTC] sander@php.net
[2002-07-01 15:38 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
When storing ips as unsigned doubles I noticed a strange behaviour when passing unsigned doubles through the long2ip routine. -- sample -- <?php $ip = ip2long("192.168.0.1"); print long2ip($ip)."\n"; if ($ip < 0) $ip+=pow(2,32); //convert from signed to unsigned print long2ip($ip)."\n"; ?> -- end --- In the first line - as supposed - the script returns "192.168.0.1", but after conversion I get an offset by one and it returns "192.168.0.0". I read in the doc that long2ip is capable of handling both signed and unsigned long integers. Peter