note 17739 added to control-structures
| From: | richard at bearware dot org dot uk | Date: | Fri, 21 Dec 2001 15:24:28 +0000 |
| Subject: | note 17739 added to control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-23753@lists.php.net to get a copy of this message | ||
If you know what is good for you when writing code pretent that the curly braces are compulsary.
(I used .ind. to show indentation)
e.g. <br>
don't type
if (exp)
.ind. statment;
do type
if (exp) {
.ind. statment;
}
I have seen meany 'C' program like this (note the indentation):
if (exp)
.ind. statment1;
.ind. statment2;
This is the same as:
if (exp) {
.ind. statment1;
}
statment2;
If you have to debug this it could make you head heart, because you know what it does, you know it
has bugs. but you dont know what the author wanted it to do.
It gets worce when you add else.
--
http://www.php.net/manual/en/control-structures.php
http://master.php.net/manage/user-notes.php?action=edit+17739
http://master.php.net/manage/user-notes.php?action=delete+17739
http://master.php.net/manage/user-notes.php?action=reject+17739