note 35550 deleted from language.control-structures by aidan
| From: | aidan@php.net | Date: | Thu, 07 Oct 2004 13:51:19 +0000 |
| Subject: | note 35550 deleted from language.control-structures by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78130@lists.php.net to get a copy of this message | ||
Note Submitter: Athon Solo
----
If you want to check for multiple conditions you can do it in atleast 2 ways:
1. Nested if statements:
<?php
if ($var1 == $var2) {
if ($var1 != $var3) {
echo $var1 ." = ". $var2 ." != ". $var3;
}
}
?>
2. All in one line:
<?php
if (($var1 == $var2) AND ($var1 != $var3)) {
echo $var1 ." = ". $var2 ." != ". $var3;
}
?>
Note: you can also use the 'OR' keyword between conditions.
You can have as many conditions as you want.
For full details on 'operators' like AND and OR, please see http://www.php.net/language.operators