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 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 "; } 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 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 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. Link to comment https://forums.phpfreaks.com/topic/100458-php-if-and/#findComment-513763 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.