I agree with you.
I think the first statment alone is enough.
"Hugh Bothwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Apologies for posting to php.windows with a
> non-windows-specific question, but I haven't
> been receiving php.general for several weeks
> now; I assume it went mailing-list-only to lower
> the load on the news server??
>
>
> I've been poking through source to a message-board script,
> and came across some code I don't quite understand;
>
> ...
> $text=ereg_replace("<[^>]*>", "", $text);
> $text=ereg_replace("^<[^>]*>", "", $text);
> $text=ereg_replace("<[^>]*>$", "", $text);
> echo $text;
> ...
>
> in context, they are trying to strip any html and/or scripty stuff out
> of the body of a message before outputting it.
>
> The first statement removes '<anything in brackets>',
> the second replaces anything in brackets starting at
> the beginning of a line...
>
> Q. Isn't that redundant? Shouldn't the first statement
> have removed all the bracket-pairs? In which case,
> this statement will never find a set of brackets and
> thus does nothing at all?!
>
> .. and the third removes anything in brackets
> followed by a dollars-sign...
>
> Q. Even more redundant!? There should be no
> bracketed stuff left by now!
>
>
> Can anyone figure out the logic behind this??
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]