wordwrap()

Two wrap a string you use the function wordwrap(): wordwrap("text", width, "line separator", cut); Example:



<?php 
    $string 
"Hello! This is a really cool function."
    
$wordwrap wordwrap($string6""); 
    echo 
$wordwrap
?>

This will output:

-------
Hello!
This
is a
really
cool
function
.
-------

Notice that each line is about 6 characters long, UNLESS a word is longer than six characters. If you want the function to cut long words in half to fit NO MORE than six characters, put a '1' in the fourth parameter.

Example:



<?php 
    $string 
"Hello! This is a really cool function."
    
$wordwrap wordwrap($string6"",1); 
    echo 
$wordwrap
?>