Til: Absätze formatieren

Beitrag lesen

Moin,

Das Problem ist, dass die verschiedenen \r\n Moeglichkeiten betriebssystemabhaengig sind, [...]

Wie wär's damit?

// ert mal alles in ein <p></p>:
   $text = '<p>' . $text . '</p>';

// doppelte Zeilenumbrüche in Absätze umwandeln:
   // Linux:
   $text = str_replace("\n\n","</p><p>",$text);
   // Windows:
   $text = str_replace("\r\n\r\n","</p><p>",$text);
   // Mac:
   $text = str_replace("\r\r","</p><p>",$text);

// einfache Zeilenumbrüche in <br /> umwandeln:
   $text = nl2br($text);

Gruß
Til