Re: Fw: [PHP] debuging and getting mor information about failures
| From: | Gabriel Guzman | Date: | Tue, 29 Jul 2003 16:44:22 +0000 |
| Subject: | Re: Fw: [PHP] debuging and getting mor information about failures | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157331@lists.php.net to get a copy of this message | ||
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:
function foo(){
}
I would write the above first, and then fill in between the {}'s. This
way, when I get to the end of my script, I know I'm at least not missing
any curly braces. 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 {}).
I know this is painfully obvious, but it does help.
gabe.
On Tue, 2003-07-29 at 09:33, Peter James wrote:
> Just forwarding this reply back to the list.
>
> ----- Original Message -----
> From: "Chris W. Parker" <cparker@swatgear.com>
> To: "Peter James" <petej@interbaun.com>
> Sent: Tuesday, July 29, 2003 10:26 AM
> Subject: RE: [PHP] debuging and getting mor information about failures
>
>
> Peter James <mailto:petej@interbaun.com>
> on Tuesday, July 29, 2003 9:18 AM said:
>
> > These errors are usually caused by an extra or missing brace or
> > quote/apostrophe/backtick. The best way to find where this is
> > happening is to use another error.
> [snip]
> > This is a very frustrating error message[snip]
>
> It also helps to learn what to look out for. Not to say that I won't
> ever have the need, but I've never needed to deliberately introduce one
> error just to find another one, especially when it's a syntax error.
>
> The best thing to do is just get used to scanning your lines of code for
> proper syntax. Make sure you always have a ; at the end of each
> statement, make sure your curly braces line up, etc.
>
> Another thing that be making this error difficult for you to find is
> because of your coding style. Your code could possibly be written in
> such a way that it doesn't make scanning it too easy therefore making it
> hard to find such tiny errors.
>
>
> hth,
> chris.