Name

wordwrap

Synopsis

string wordwrap(string string[, int length[, string postfix[, bool force]]])

Inserts postfix into string every length characters and at the end of the string and returns the resulting string. While inserting breaks, the function attempts to not break in the middle of a word. If not specified, postfix defaults to \n and size defaults to 75. If force is given and is true, the string is always wrapped to the given length (this makes the function behave the same as chunk_split()).

Get Programming PHP, 3rd Edition 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.