note 101034 deleted from control-structures.if by cmb
| From: | cmb@php.net | Date: | Fri, 02 Oct 2020 12:58:57 +0000 |
| Subject: | note 101034 deleted from control-structures.if by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215518@lists.php.net to get a copy of this message | ||
Note Submitter: admin at leonard !spam challis dot com
----
When using if statements without the curly braces, remember than only one statement will be executed
as part of that condition. If you want to place multiple statements you must use curly braces, and
not just put them on the same line.
<?php
if (1==0) echo "Test 1."; echo "Test 2";
?>
Whereas some people would expect nothing to be displayed, this piece of code will show: "Test
2".