Query: wordwrap
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
WORDWRAP(3) 1 WORDWRAP(3) wordwrap - Wraps a string to a given number of charactersSYNOPSISstring wordwrap (string $str, [int $width = 75], [string $break = "0], [bool $cut = false])DESCRIPTIONWraps a string to a given number of characters using a string break character.PARAMETERSo $str - The input string. o $width - The number of characters at which the string will be wrapped. o $break - The line is broken using the optional $break parameter. o $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). When FALSE the function does not split the word even if the $width is smaller than the word width.RETURN VALUESReturns the given string wrapped at the specified length.EXAMPLESExample #1 wordwrap(3) example <?php $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($text, 20, "<br /> "); echo $newtext; ?> The above example will output: The quick brown fox<br /> jumped over the lazy<br /> dog. Example #2 wordwrap(3) example <?php $text = "A very long woooooooooooord."; $newtext = wordwrap($text, 8, " ", true); echo "$newtext "; ?> The above example will output: A very long wooooooo ooooord. Example #3 wordwrap(3) example <?php $text = "A very long woooooooooooooooooord. and something"; $newtext = wordwrap($text, 8, " ", false); echo "$newtext "; ?> The above example will output: A very long woooooooooooooooooord. and somethingSEE ALSOnl2br(3), chunk_split(3). PHP Documentation Group WORDWRAP(3)
Related Man Pages |
---|
nl2br(3) - php |
hash(3) - php |
json_last_error(3) - php |
rtrim(3) - php |
substr_compare(3) - php |
Similar Topics in the Unix Linux Community |
---|
no count of spaces in cut |
Replace One String With Another String |
Sed or awk cut all lines after word |
Text Processing with a line break |
Count the words starting with 3- |