Re: note 8377 added to Control Structures
| From: | J. M. Castagnetto | Date: | Fri, 08 Sep 2000 23:12:57 +0000 |
| Subject: | Re: note 8377 added to Control Structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4577@lists.php.net to get a copy of this message | ||
I am not following your logic. Shouldn't it be:
if ($x != 'yes' && $x != 'yeah')
if you want to exclude both values when executing the
code, otherwise if $x contains 'yes' or 'yeah' it will
just execute the code in the if, because at least one
of the statements will be true.
BTW, the notes are not a place to ask for support
question, check the "Support" section in www.php.net
for that.
Note will be removed.
--- jeffb@burst.com wrote:
> I have noticed that:
>
> if (($x != 'yes') || ($x != 'yeah'))
> {
> do some stuff
> }
>
> does not work as expected. I had to break them apart
> into separate if statements.
>
> I realize switch will work for this, but it ends up
> being much more code than needed.
>
> http://www.php.net/manual/control-structures.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/