No not a bug. Maybe just the loose nut behind the keyboard. :<>

Change the assignment for variable $x to:
$x="0";

In the first if you are using "==". This will only compare values. As you know 
the second if "==="
compares the value and type.

I always try and stay away from "$var = 0" expressions. 

Check this PHP page 
http://us2.php.net/manual/en/language.operators.comparison.php on this page is
the statement
"If you compare an integer with a string, the string is converted to a number."


P-

--- Ross Honniball <[EMAIL PROTECTED]> wrote:

> $x = 0; // Numeric zero
> $y = 'Some kind of string';
> 
> if ($x == $y) echo 'they equal using ==';
> if ($x === $y) echo 'they equal using ===';
> 
> The above will echo 'they equal using =='.
> 
> The values don't look very equal to me.
> 
> Can anyone explain the logic behind this?
> 
> I'm heading home now but look forward to your explanations tomorrow.
> 
> PS
> 
> Incidently, to 'fix' it so it behaves as it should, you can code:
> 
> if ($x.'' == $y.'') echo 'this will not print and all is good.';
> 
> Regards .. Ross
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to