Here is the code I have and it works.
PHP Code:
<?php
$paragraphTags = "This is a test\n";
$paragraphTags = str_replace("\n", "</p>\n<p>", '<p>'.trim($paragraphTags, "\n").'</p>');
var_dump($paragraphTags);
?>
You can also try it with preg_replace to replace carriage returns and newlines
PHP Code:
<?php
$paragraphTags = "This is a test\r\n";
//$paragraphTags = str_replace("\n", "</p>\n<p>", '<p>'.trim($paragraphTags, "\n").'</p>');
$paragraphTags = preg_replace("/(\r\n|\r|\n)/", "</p>\n<p>", '<p>'.trim($paragraphTags, "\r\n").'</p>');
var_dump($paragraphTags);
?>
Bookmarks