Wordwrap example

Shows how to use the build-in function "wordwrap" to create line breaks by a user definied length.
// create a long text for testing: $long_text = 'This is a long text to demonstrate the usage of the '; $long_text .= 'wordwrap function. '; $long_text .= 'Fooooooooooooooooobar, just fooling around'; // syntax: wordwrap(input string, line max. width, break chars, cut words) $new_text = wordwrap($long_text, 15, "<br/>\n", true); print $new_text; /* The output will be: This is a long<br/> text to<br/> demonstrate the<br/> usage of the<br/> wordwrap<br/> function.<br/> Foooooooooooooo<br/> ooobar, just<br/> fooling around */

Url: http://www.jonasjohn.de/snippets/php/wordwrap-example.htm

Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013