text_to_paragraphs — Replace newlines in a block of text with paragraph tags.

Text-related functions

Summary

text_to_paragraphs($str)

Replace newlines in a block of text with paragraph tags.

Looks for 2 consecutive line breaks resembling a paragraph break and wraps each of the paragraphs with a <p> tag. If no paragraphs are found, then the original text will be wrapped with line breaks.

Parameters:
  • $str (string) –

Returns:

string

Usage

Examples

See Also