Home > PHP > Function > Strings > wordwrap()

wordwrap()

wordwrap - Wraps a string to a given number of characters

Syntax

string wordwrap (string $str, int $width, string $break, bool $cut)

Arguments

  • str - The input string.
  • width - The column width.
  • break - The line is broken using the optional break parameter.
  • cut - If the cut is set to TRUE, the string is always wrapped at or before the specified width. So if you have a word that is larger than the given width, it is broken apart. (See second example).

Description

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

Version

PHP 4.0.2, 5

Return value

Returns the given string wrapped at the specified column.