Edit report at http://bugs.php.net/bug.php?id=53429&edit=1

 ID:                 53429
 Updated by:         ras...@php.net
 Reported by:        claudsan at gmail dot com
 Summary:            comparing the integer 0 "Zero" with any other string
                     always returns true
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows 7
 PHP Version:        5.3.3
 Block user comment: N
 Private report:     N

 New Comment:

What is the integer value of the string "foo" ?  When you are using a
loosely 

typed language you have to understand that there will be type juggling
when you 

try to compare an integer to a string.  If you want a strict comparison,
use ===.


Previous Comments:
------------------------------------------------------------------------
[2010-11-30 18:32:26] claudsan at gmail dot com

comparing the integer 0 "Zero" with any other string always returns true

------------------------------------------------------------------------
[2010-11-30 18:30:18] claudsan at gmail dot com

Description:
------------
comparing the integer 0 "Zero" with any other string always returns null

Test script:
---------------
$x =(int) 0;

if($x == 'foo')

echo "Zero is foo";



//or



var_dump($x == 'foo');



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53429&edit=1

Reply via email to