logical or (Was: [thelist] Redirection)

Howard Cheng howcheng at ix.netcom.com
Fri Jul 26 17:55:00 CDT 2002


The || operator returns true when either of the two expressions is true. So
in your example, this always returns true because 'that' is a literal, so
by definition it's true.

So proper usage is like:

if ($x == 'this' || $x == 'that') { }

$b = true;
if ($x == 'this' || $b) { }

At 12:31 PM 7/26/2002 -1000, John Corry wrote:
>I've always had trouble with:
>if ($x == 'this' || 'that'), even though according to the docs it seems
>like it should work.

::::::::::::::::::::::
Howard Cheng
howcheng at ix.netcom.com
AIM: bennyphoebe
ICQ: 47319315




More information about the thelist mailing list