Date: 05/20/00
- Next message: Bug Database: "[PHP-DEV] Bug #3922 Updated: == bug"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] Bug #3922 Updated: == bug"
- In reply to: Zeev Suraski: "Re: [PHP-DEV] Bug #3922 Updated: == bug"
- Next in thread: Bug Database: "[PHP-DEV] Bug #3922 Updated: == bug"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Zeev Suraski wrote:
> > 0 == 'N/A' -> true
> > 'N/A' == 0 -> false
>
> What do you mean by that? There's no difference between (0=='N/A') and
> ('N/A'==0) in both PHP 3.0 and 4.0 - both of the lvalue and rvalue
> behave in the same way.
uh, stupid me, did only the mind test, not the real thing :(
(influenced by browsing some c++ books lately)
but then this is an even more confusing behavior ...
i would have thought that '==' worked by casting the right
expression to the type of the left before comparing them
so the result for '0 == "N/A"' would by true due tue
'0 == (int)"N/A"' although not obvious in the first place,
but then '"N/A" == 0' should be interpreted as
'"N/A" == (string)0' resulting in false ...
knowing about lex, yacc and friends, i can see what's going
on here and i know that '===' is the answer but even i
assumed that '===' was more for resolving things like
'"1"==1' and never thought about this special case
anyway, i think closing the bug was still okay, i'll just edit out
the other-way-round part
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Bug Database: "[PHP-DEV] Bug #3922 Updated: == bug"
- Previous message: Zeev Suraski: "Re: [PHP-DEV] Bug #3922 Updated: == bug"
- In reply to: Zeev Suraski: "Re: [PHP-DEV] Bug #3922 Updated: == bug"
- Next in thread: Bug Database: "[PHP-DEV] Bug #3922 Updated: == bug"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

