Re: Re: == and ===

From: Date: Mon, 18 Apr 2005 19:51:17 +0000
Subject: Re: Re: == and ===
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-16022@lists.php.net to get a copy of this message
> <?php echo '0' == '0.0000e0' ?> > 1 > > <?php echo '0' == 'asadoaskd' ?> > (nothing, false) > > <?php echo '0' == (int)'adasd' ?> > 1 > > That confuses me more (but understandable, and thank God PHP behave > this way)... I thought 'asdasd' is 0 when [implicitly] converted to > int [for comparison]? I guess I never knew PHP well :-( > That would be the 'Roughly Speaking' and 'not precisely how the engine handles it internally' parts. In the case of string to string comparison there must be at least one digit involved at the start of the string (or a plus/minus sign followed by digits, etc...) in order to qualify as a numeric string. if (int && string) convert to int if (string && int) convert to int if (string && string && both strings start with numerics) convert both to int There's also float versions of those, but... you get the picture. -Sara

« previous php.internals (#16022) next »