> > could somebody explain me please what is wrong with this
> > piece of code?
> > <?
> >     if (1):
> >         if (1) echo "hello";
> >     else:
> >     endif;
> > ?>
>
>  Well, first off you've broken the golden rule, which is: Don't mix the
:-type syntax with the {}-type or completely bare syntaxes.
>
> In more detail:  on reaching the "else", PHP matches it with the nearest
preceding if; this is the "If (1) echo ..." line, which isn't using :-type
syntax, so it expects the else also not to use :-type syntax -- so the : is
a parse error.

now it's clear to me
anyway it's funny that this works fine :-)
<?
    if (1):
        if (1) echo "hello";
        $a = 1;                // here can be anything else
    else:
    endif;
?>



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

Reply via email to