wordwrap

1.0 1.1 1.2 1.3

Wraps a text at the given line length

<?php
wordwrap(string $value, [ int $length = 80, [ string $break = "\n", [ bool $cut = false ]]])
  • value: the text to wrap
  • length: maximum line length
  • break: the character(s) to use to break the line
  • cut: if true, the line is cut at the exact length instead of breaking at the nearest space

Examples

Example #1

index.tpl
{wordwrap "abcdefghijklmnopqrstuvwxyz" 8 cut=true}

The above example will output:

abcdefgh
ijklmnop
qrstuvwx
yz