RE: Fw: [PHP] debuging and getting mor information about failures
| From: | Chris W. Parker | Date: | Tue, 29 Jul 2003 16:56:26 +0000 |
| Subject: | RE: Fw: [PHP] debuging and getting mor information about failures | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-157337@lists.php.net to get a copy of this message | ||
Gabriel Guzman <mailto:gabe@careercast.com>
on Tuesday, July 29, 2003 9:44 AM said:
> A tip on avoiding errors cause by not enough }'s is to close any
> bracket immediately after you open it, so if I were writing a block
> of code:
Good tip. I do this too.
> I would write the above first, and then fill in between the {}'s.
[snip]
> You can do this with others, but these are
> usually the hardest to track down once you have a large amount of
> code (with a large number of {}).
Especially when you write code like:
function doit() {
for() {
if() {
...
} else {
...
}
}
}
As opposed to the much easier to read (and line up curly braces) method:
function doit()
{
for()
{
if()
}
...
}
else
{
...
}
}
}
See how those curly braces line up all nicely? ;)
chris.