note 109540 added to control-structures.if
| From: | johannes dot kingma at gmail dot com | Date: | Fri, 27 Jul 2012 08:46:23 +0000 |
| Subject: | note 109540 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189419@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 212.117.124.138
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/109540
Del: integrated -- https://master.php.net/note/delete/109540/integrated
Del: useless -- https://master.php.net/note/delete/109540/useless
Del: bad code -- https://master.php.net/note/delete/109540/bad+code
Del: spam -- https://master.php.net/note/delete/109540/spam
Del: non-english -- https://master.php.net/note/delete/109540/non-english
Del: in docs -- https://master.php.net/note/delete/109540/in+docs
Del: other reasons-- https://master.php.net/note/delete/109540
Reject -- https://master.php.net/note/reject/109540
Search -- https://master.php.net/manage/user-notes.php