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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.