wordwrap

(PHP4 CVS only)

wordwrap --  Wraps a string to a given number of characters using a string break character.

Description

string wordwrap (string str [, int width [, string break]])

Wraps the string str at the column number specified by the (optional) width parameter. The line is broken using the (optional) break parameter.

wordwrap() will automatically wrap at column 75 and break using '\n' (newline) if width or break are not given.

Example 1. wordwrap() example


$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap( $text, 20 );

echo "$newtext\n";
      

This example would display:


The quick brown fox
 jumped over the lazy dog.
      

See also nl2br().