This seems to me to be inconsistent/buggy behavior on the part of
the PHP parser.

To be consistent, I would think that it would want to act like an
HTML parser (browser), which will recognize the first ?>,
regardless of where it occurs.  The idea being that if the PHP
code is passed through a server that doesn't execute PHP, the
code will not appear display.

> -----Original Message-----
> From: Ed Gorski [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 28, 2002 4:53 PM
> To: Kevin Stone; Jonathan Rosenberg; Johnson Kirk;
> [EMAIL PROTECTED]
> Subject: Re: [PHP] comment followed by ?> fails to parse
>
>
> No, if you use /* ? */ as a comment the parser will
> skip right over
> it.....if you want to use sample code in your script just use:
>
> /*
> <?
>     code here....
> ?>
> */
>
> that'll work fine
>
> ed
>
> At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
> >I've run into this before as well.  Pain in the ass
> when you want to put
> >example code in your header.  It's gotta be a deisgn flaw.
> >
> >// literal.. legal
> >$tmp = '?>';
> >
> >// reg ex.. legal
> >ereg('?>', $tmp);
> >
> >// Comment.. illegal.  Why?  Makes no sense.
> >/*?>*/
> >
> >-Kevin
> >
> >
> >----- Original Message -----
> >From: "Jonathan Rosenberg" <[EMAIL PROTECTED]>
> >To: "Johnson, Kirk" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> >Sent: Tuesday, May 28, 2002 2:46 PM
> >Subject: RE: [PHP] comment followed by ?> fails to parse
> >
> >
> > > BTW: if my last message was correct, this means that an
> > > occurrence of ?> embedded in a string literal will
> also cause
> > > problems.
> > >
> > > > -----Original Message-----
> > > > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, May 28, 2002 4:08 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: RE: [PHP] comment followed by ?> fails to parse
> > > >
> > > >
> > > > I have wondered for some time if this is a bug or just
> > > > an interesting design
> > > > choice ;) I agree with you, I was surprised when I
> > > > first encountered this.
> > > > But it is what it is, so code accordingly.
> > > >
> > > > Kirk
> > > >
> > > > > -----Original Message-----
> > > > > From: Thalis A. Kalfigopoulos
[mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, May 28, 2002 1:21 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP] comment followed by ?> fails to parse
> > > >
> > > >
> > > > If I write a comment line with // and I include in
> > > it ?> then
> > > > it fails to parse the rest of the page because (i'm
> > > guessing)
> > > > the parser gets confused and goes off PHP mode.
> > > > Is this normal? Shouldn't I be able to write literally
> > > > ANYTHING on a comment line?
> > > >
> > > > Sample Code:
> > > >
> > > > <?
> > > > //bla bla ?>
> > > > $var=1;
> > > > ?>
> > > >
> > > > Output:
> > > >
> > > > $var=1; ?>
> > > >
> > > >
> > > > cheers,
> > > > thalis
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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



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

Reply via email to