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

 ID:                 53429
 Comment by:         claudsan at gmail dot com
 Reported by:        claudsan at gmail dot com
 Summary:            comparing the integer 0 "Zero" with any other string
                     always returns true
 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:

Ok I understand that all strings when converted to integer assigned the
value 0 "zero" in these situations really should use the sign ===



Thanks.


Previous Comments:
------------------------------------------------------------------------
[2010-11-30 19:11:47] claudsan at gmail dot com

Ok entendi que todas as strings quando convertidas para integer recebe o
valor 0 "zero", nestas situações realmente deve se utilizar o sinal
===



Obrigado.

------------------------------------------------------------------------
[2010-11-30 19:03:35] ras...@php.net

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 ===.

------------------------------------------------------------------------
[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