wordwrap

string wordwrap(string string, [int width], [string break], [int cut]) 
string String to break into lines
width Maximum width of the lines
break One or more characters to be used as the break between lines
cut How long words are broken

Breaks a string into multiple lines.

Returns:

String; FALSE on error

Description:

wordwrap() breaks a string into one or more lines. The default behavior for the function is to create lines of 75 characters (or fewer), separated by newlines. Each line breaks only on a whitespace character—when the line is broken, the character that the line was broken on is replaced with a newline.

This function is quite flexible—the width of the lines can be controlled with the width argument, while the character ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.