Addressed to: Jason Murray <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from Jason Murray <[EMAIL PROTECTED]> Wed, 21 Feb 2001 11:37:40
-0600
>
> Hi,
>
> I came across this:
>
> $confidential = 0;
> echo "$confidential " . ($confidential == "yes");
>
> In which "0 1" was printed.
>
$confidential = 0; # Numeric 0
That explains the 0.
$confidential == "yes"
This is a little tricky. The numeric value of 'yes' is 0, so it
evaluates to the same thing as 0 == 0, which is true. True has a
numeric value of 1, although all values besides 0 are considered true.
You might want to look at the === operator which checks that both the
value and the type of the operands is identical.
http://www.php.net/manual/en/html/language.operators.comparison.html
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]