DanielWhite Posted April 10, 2008 Share Posted April 10, 2008 If I have the following code: <?php if ($a > $b) { echo "a is bigger than b"; } elseif ($a == $b) { echo "a is equal to b"; } else { echo "a is smaller than b"; } ?> How can I make it so it is something like this: $a > $b AND $c = 5 Thank you, Daniel White Quote Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/ Share on other sites More sharing options...
marcus Posted April 10, 2008 Share Posted April 10, 2008 if($a > $b && $c == 5){ echo "WINNAR"; }else { echo "fail "; } Quote Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/#findComment-513732 Share on other sites More sharing options...
DanielWhite Posted April 10, 2008 Author Share Posted April 10, 2008 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/#findComment-513734 Share on other sites More sharing options...
DanielWhite Posted April 10, 2008 Author Share Posted April 10, 2008 OK How about if I want that following: a == 1 && b == 2 but also c >= 10 but not > 20 Quote Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/#findComment-513762 Share on other sites More sharing options...
Daniel0 Posted April 10, 2008 Share Posted April 10, 2008 if ($a == 1 && $b == 2 && $c >= 10 && !($c > 20)) {{ // code here } Reading this part of the PHP manual might be a good idea. Quote Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/#findComment-513763 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.