On Tue, 2004-01-20 at 15:55, Jonathan Pitcher wrote:
> I am so frustrated at the moment with coding. I had an odd error with
> some PHP coding. And in the process I came across this error.
>
> Please try this out!! Because for me on my machine it does the first
> part of the if statement. I can make a work around in my code to fix
> the error. BUT I would rather know why this is evaluating incorrectly.
>
> <?PHP
>
> $EA = 0;
>
> if ($EA == "NFH")
> {
> echo "<br>EA is Equal To NFH see $EA<br>";
> }
> else
> {
> echo "<br>EA is NOT EQUAL to NFH see $EA<br>";
> }
> ?>
Interesting. I wouldn't have expected that. However, that is how it
should work. Check out table K-2 on this page:
http://us4.php.net/manual/en/types.comparisons.php
'==' is a loose comparison. You can use '===' instead which will give
you the results you are looking for.
if ($EA === "NFH")
- Brad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php