Mutley Posted March 18, 2007 Share Posted March 18, 2007 I know in PHP, that "or" is: || Then "and" is: && How do I do and, and or? Or should "||" do the exact same thing on its own? Quote Link to comment https://forums.phpfreaks.com/topic/43240-andor/ Share on other sites More sharing options...
per1os Posted March 18, 2007 Share Posted March 18, 2007 http://us3.php.net/manual/en/language.operators.logical.php That should help you out. Quote Link to comment https://forums.phpfreaks.com/topic/43240-andor/#findComment-209957 Share on other sites More sharing options...
cmgmyr Posted March 18, 2007 Share Posted March 18, 2007 can you list an example of what you would like to do? Maybe something like this: if($a == 0 && $b == 1 || $c == 3){ echo "You did it"; } Quote Link to comment https://forums.phpfreaks.com/topic/43240-andor/#findComment-209965 Share on other sites More sharing options...
ted_chou12 Posted March 18, 2007 Share Posted March 18, 2007 by using brackets: if($a == 0 && ($b == 1 || $c == 3)){ echo "You did it"; } would help to make your statements more clear and less complicated. Ted Quote Link to comment https://forums.phpfreaks.com/topic/43240-andor/#findComment-210034 Share on other sites More sharing options...
cmgmyr Posted March 18, 2007 Share Posted March 18, 2007 true...you can also make different statements with putting the brackets in different places: if($a == 0 && ($b == 1 || $c == 3)){ echo "You did it"; } is not the same as: if(($a == 0 && $b == 1) || $c == 3){ echo "You did it"; } Quote Link to comment https://forums.phpfreaks.com/topic/43240-andor/#findComment-210039 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.