At 12:19 PM -0400 7/29/02, <[EMAIL PROTECTED]> wrote:
>   I added a few number_format() statements to previously working code (not
>having changed any {}s ) and it started getting parse errors, 'unexpected
>t_if, expected t_while'.  In other words, it thinks the do statement shown
>below has been closed, and wants to hear about the while part.
>
>     I checked over the sets of braces about 10 times, but the only way to
>fix it ended up being to have an uneven number of braces - two close braces
>needed eliminating.  I'm not going to post all the code unless it's
>necessary but here is the basic control structure.  I've shown here what
>braces I commented out.  All of the below is escaped in and out of HTML many
>times.
>
>     PHP 4.2.2 on Windows 2000 Professional.  Is this a bug, or have people
>experienced weird problems with braces before?
>
>Regards,
>Colin Teubner
>
>if (){
>     do {
>         if (){
>             while () {}
>             if () ;
>             else if ();
>             else ;
>         }


I assume you mean

        if () :
        else if ():
        else :

here (colon instead of semicolon)? AFAIK PHP doesn't allow the 
alternative syntax -

        http://php.he.net/manual/en/control-structures.alternative-syntax.php

- with semicolons. Or do you really mean

        if () {}
        else if () {}
        else {}

If you are using the alternative syntax, I recall several messages 
about people having problems nesting both forms of syntax. Try using 
all one style or the other.

Lastly, quadruple check that you haven't accidentally quoted or 
double-quoted a { or ( or something that you THOUGHT was part of PHP 
code; syntax highlighting editors can definitely help here.

        -steve


>         if () {}
>         if () {
>             if {
>                 }
>         // }
>         if () {
>             if {
>                 }
>         // }
>     } while ();
>     if() {} //(4x)
>}
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| The end to politics as usual:                                          |
|                 The Monster Raving Loony Party (http://www.omrlp.com/) |
+------------------------------------------------------------------------+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to