Mailinglisten-Archive |
Hi Mathias,
On Tue, Oct 21, 2003 at 11:45:49AM +0200, Gloss Mathias wrote:
> [...]
>
> Die Lösung $new = preg_replace('/\r\n|\r|\n/', '<br>', $string);
> von Thomas Langfeld ist IMHO das optimum.
Eine Lösung ist es, aber mich würde interessieren inwiefern diese
Lösung das Optimum darstellt.
Ich behaupte, dass folgendes bezüglich Performance ca. ein Fünftel
der Zeit benötigt:
$txt = str_replace ('\r\n', '\n', $txt);
$txt = str_replace ('\r', '\n', $txt);
$txt = str_replace ('\n', '<br>', $txt);
Grüße,
Martin
php::bar PHP Wiki - Listenarchive