I ended up using this:
Code:
$text = ereg_replace("\r","",$text);
$text = ereg_replace("\n","<br />\n",$text);
$text = ereg_replace(".<br />","\n</p>\n<p>",$text);
It enables me to format the contents of the txt file in a way that matches the surrounding markup (à la
view source).
nl2br() is great, but a little too basic for my (pedantic) needs.
I'm wearing my
PHP is fun! badge today.