Re: Disturbing parsing problems

From: Date: Mon, 29 Jul 2002 16:44:54 +0000
Subject: Re: Disturbing parsing problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110212@lists.php.net to get a copy of this message
At 12:19 PM -0400 7/29/02, <cteubner@ncw-av.com> 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 sbedberg@ucdavis.edu | | 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/) | +------------------------------------------------------------------------+

« previous php.general (#110212) next »