Edit report at https://bugs.php.net/bug.php?id=55738&edit=1
ID: 55738 Updated by: larue...@php.net Reported by: vlado107 at yahoo dot com Summary: intval IP address Status: Bogus Type: Bug Package: Unknown/Other Function Operating System: Win PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: (number)127.0.1.1 = (number) 127.0 = (int) 127 (number)127.1.1.1 = (number) 127.1 = (float) 127.1 Previous Comments: ------------------------------------------------------------------------ [2011-09-20 21:49:18] vlado107 at yahoo dot com (number) 127.1.1.1 = 127.1 Yes, this is ok. $ip = '127.1.1.1'; echo $ip == intval($ip); Ti is false and it should be false because 127.1.1.1 is not equal with 127.1 Problem is if IP is 127.0.1.1 $ip = '127.0.1.1'; echo $ip == intval($ip); // true This is 127.0.1.1 == 127.0 and it is true. How it can be true? It should be false like in first case. ------------------------------------------------------------------------ [2011-09-20 11:27:00] larue...@php.net sorry, typo. (number) 127.1.1.1 = 127.1 ------------------------------------------------------------------------ [2011-09-20 11:25:59] larue...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php (number) 127.1.1.1 = 127.0 ------------------------------------------------------------------------ [2011-09-20 10:02:53] vlado107 at yahoo dot com Description: ------------ Problem in some cases when use intval($ip); Test script: --------------- $ip = '127.0.1.1'; echo $ip == intval($ip); // true $ip = '127.1.1.1'; echo $ip == intval($ip); // false Expected result: ---------------- Both result should be false ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55738&edit=1