|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-26 05:21 UTC] phpbug at labres dot at
[2004-03-26 09:09 UTC] phpbug at labres dot at
[2004-03-26 11:06 UTC] derick@php.net
[2004-04-03 08:41 UTC] nlopess@php.net
[2020-02-07 06:12 UTC] phpdocbot@php.net
[2020-02-07 07:30 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
Description: ------------ When given network addresses (partial ip addresses)*), ip2long() calculates erratic values: Input Output dechex should be 192 int(192) c0 c0000000 192.168 int(-1073741656) c00000a8 c0a80000 192.168.1 int(-1062731775) c0a80001 c0a80100 *) you will need this to convert 192/8, 192.168/16 etc network addresses. Reproduce code: --------------- $net=ip2long("192"); echo dechex($net)."\n"; $net=ip2long("192.168"); echo dechex($net)."\n"; $net=ip2long("192.168.1"); echo dechex($net)."\n"; Expected result: ---------------- c0000000 c0a80000 c0a80100 Actual result: -------------- c0 c00000a8 c0a80001