note 123369 deleted from control-structures.if by cmb
| From: | cmb@php.net | Date: | Fri, 02 Oct 2020 12:23:16 +0000 |
| Subject: | note 123369 deleted from control-structures.if by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215511@lists.php.net to get a copy of this message | ||
Note Submitter: christian johansson
----
It can be tricky to know what commands are executed if these expressions are stacked, here is an
overview, general rule is that only the first statement following a true conditional will be
executed.
php > if (true) if (true) if (true) echo "1 "; echo "2 "; echo "3
"; echo "4 ";
1 2 3 4
php > if (true) if (true) if (false) echo "1 "; echo "2 "; echo "3
"; echo "4 ";
2 3 4
php > if (true) if (false) if (false) echo "1 "; echo "2 "; echo "3
"; echo "4 ";
2 3 4
if (false) if (false) if (false) echo "1 "; echo "2 "; echo "3 "; echo
"4 ";
2 3 4