How to Turn Line Breaks Into Paragraphs With PHP
- 1). Right-click the PHP file you want to edit and select "Open With." Click the PHP editor you want to use to create the PHP code.
- 2). Locate the string that creates the HTML for your pages. The following code is an example of an HTML string with two break tags:
$html = "This is my first paragraph. This is the second paragraph. "; - 3). Replace the "" characters using the "str_replace" function. The following code shows how to replace the characters with a "<p>" tag:
$html = str_replace("", "<p>", $html) - 4). Print the result to the Web browser. The following code prints the HTML to the user's browser with the new "<p>" tags:
echo $html;
Source...