$nl = "\r\n"; $textarr = explode ($nl, $text); /* ... */ foreach ($textarr as $paragraph) { echo "<p>$paragraph</p>$nl"; }