Proper Paragraphs





21
Date Submitted Fri. Nov. 11th, 2005 2:51 PM
Revision 1 of 1
Beginner Possibility
Tags Paragraph | PHP | String
Comments 0 comments
Proper Paragraphs
function paragraphs($text) {
        $fulltext = '';
        $text_array = explode("\n\n", $text);
        foreach($text_array AS $ta) {
                $ta = str_replace("\n", "<br />", $ta);
                $fulltext =. "<p>" . $ta . "</p>";
        }
        return $fulltext;
}

Comments

There are currently no comments for this snippet.

Voting