Re: Bug #3922 Updated: == bug

From: Date: Sat, 20 May 2000 08:27:42 +0000
Subject: Re: Bug #3922 Updated: == bug
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-18999@lists.php.net to get a copy of this message
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

« previous php.dev (#18999) next »