I am sure I read somewhere that doing the following
if (false === $variable)
was a better option than
if ($variable === false)
maybe it was a dream or is there something in this?
=== is type-safe comparison (iirc) == is not type-safe = is assignment (obviously)
if ($variable = "foo") will always be true (you are assigning a value to a variable, and unless by some cosmic occurance it cannot assign a variable, that will be the only time that would return false).
if ($variable == "foo") will compare the value of $variable and return true of its "foo"
if ("foo" = $variable) this will generate an error because you are trying to assign a value to a literal (string). It helps catch the "== where = should be" type errors.
if ("foo" == $variable) this will comapre the value of $variable and return true of its "foo"
if ($variable === "foo") this will return true only if $variable is a string "foo" (iirc).
Hopefully this helps, -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com ----------------------- "Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing."
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php