it is proper syntax to use "||" and/or "&&" within PHP IF/ELSE statements like javascript?
|| && ?
Collapse
X
-
here's an example of what i mean:
i'm asking this question because this statement doesn't seem to work because if "Country0" is selected, it will still echo the statement...Code:if (($specifycountry != "Country0") || ($specifycountry != "Country44")) {echo "$specifycountry<br>\n";}
any ideas? -
i took a php class a while back and all of that stuff was in our text books so i would and it is also in several tutorials i have read so i would assume that it is good programing practice. i've always thought the fewer if/else statements the better. i hate lots of code. if i can reduce lines i do
ericComment
-
[PHP]if (($specifycount ry != "Country0") || ($specifycountr y != "Country44" ))
{echo "$specifycountr y<br>\n";} [/PHP]
Yes, and that is correct. The statement will print if either $specifycountry is not Country0 OR $specifycountry is not Country44. If you select Country0 it will fail the first condition but pass the second and so return TRUE. You need to study your BOOLEAN logic a little more.i'm asking this question because this statement doesn't seem to work because if "Country0" is selected, it will still echo the statement...Comment
Comment