|
Posted by julian_m on 07/07/06 20:26
Andy Hassall wrote:
> On 7 Jul 2006 13:02:11 -0700, "julian_m" <julianmaisano@gmail.com> wrote:
>
> >Alvaro G. Vicario wrote:
> >
> >> According to manual:
> >>
> >> The "one-line" comment styles only comment to the end of the line or the
> >> current block of PHP code, whichever comes first. This means that HTML code
> >> after // ... ?> or # ... ?> WILL be printed: ?> breaks out of PHP mode and
> >> returns to HTML mode, and // or # cannot influence that.
> >>
> >> It sounds like the logical option to me.
> >
> >I didn't know that, now I understand how it works, although IMO, the
> >line I commented was not de end of the current block of PHP:
> >
> >//$res= preg_replace('#<\s*(p|span|li|ul|ol)\s+.*?>#si', '<\1>',$str);
> >
> >Note that ?> is a string there.
>
> Ah, but it isn't in a string, because it's in a comment.
>
> (Sounds circular, but actually it's not).
Right.
Even though someone could think "hey dude, just comment with /* */ and
go ahead". there are situations, dealing with regex, where it wouldn't
work. For instance:
/*
preg_replace('#(<\s*span\s*>\s*<\s*/\s*span\s*>|<\?xml\s*:\s*namespace.*?>|<\s*/?\s*o\s*:\s*p\s*>)#si','',...)
*/
It's really annoying isn't it?
regards - julian
Navigation:
[Reply to this message]
|