[thelist] Problems with a php script being brought in as an

Lachlan Cannon luminosity at members.evolt.org
Tue Apr 30 21:09:01 CDT 2002


Chris George said:
> I've taken into account apostrophe's with addslashes() and also
> replaced returns with <br>'s...
>
> $newsText = ereg_replace("(rn|n|r)", "<br>",$newsText);

Chris, what's wrong with nl2br($newsText)? Native functions will always run
faster. Plus you don't have to worry about writing the rules out. Also, if
you really had to write your own function str_replace is faster than
ereg_replace. You should only use ereg_replace if you have to use a regular
expression.

Lach





More information about the thelist mailing list