le007 Posted October 15, 2007 Share Posted October 15, 2007 Can't find on google how to do an if statement like this: if a = b or a = c or a = d does it have to be if else? Also if a = b and b = c??? Dunno how to do these if's in php yet? Thanks, Leo Quote Link to comment Share on other sites More sharing options...
simcoweb Posted October 15, 2007 Share Posted October 15, 2007 if((a == b) || (b == c)){ echo "execute your code here"; } else { echo "nothing equalled anything"; } if((a == b) and (b == c)) { echo "execute your code here"; } else { echo "nothing matched so nothing done"; } Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 15, 2007 Share Posted October 15, 2007 You're best bet is to read the PHP manual Some examples: <?php if ($a == $b || $a == $c || $a == $d) echo 'ok'; if ($a == $b && $a == $c) echo 'also ok'; ?> Ken Quote Link to comment Share on other sites More sharing options...
coder_ Posted October 15, 2007 Share Posted October 15, 2007 I'm to slow to post.. P.S. Did you RTFM??? Quote Link to comment Share on other sites More sharing options...
le007 Posted October 15, 2007 Author Share Posted October 15, 2007 Thanks for reply - would this work? if (a == b || a == c){ Also whats ! for? Thanks! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 15, 2007 Share Posted October 15, 2007 Variables in PHP start with a "$". The "!" is the "not" operator. Ken Quote Link to comment Share on other sites More sharing options...
le007 Posted October 15, 2007 Author Share Posted October 15, 2007 Ok thanks everyone - I'll read up but the above info has helped and solved the problem! Cheers, Leo Quote Link to comment Share on other sites More sharing options...
simcoweb Posted October 15, 2007 Share Posted October 15, 2007 I can't believe I forgot the $'s. Quote Link to comment 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.