note 109540 deleted from control-structures.if by googleguy
| From: | googleguy@php.net | Date: | Wed, 10 Oct 2012 20:36:16 +0000 |
| Subject: | note 109540 deleted from control-structures.if by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191242@lists.php.net to get a copy of this message | ||
Note Submitter: johannes dot kingma at gmail dot com
----
in order to check two conditions at the same time use one of the binary operators 'and' or
'or'. So instead of
<?php
if( cond1 ) {
if( cond2 ) {
// statements
}
else {
// statements
}
}
?>
write:
<?php
if( cond1 and cond2 ) {
// statements
}
else {
// statements
}
?>
be aware though that when cond1 is false cond2 will not be evaluated.