wordwrap() doesn't break at your line limit if a word has more characters than the limit.
<?php
$string = "this is a test. this is a test.this is a test.this is a test.this is a test.";
$string .= "this is a test.this is a test.this is a test.this is a test.this is a test.!";
print wordwrap( $string, 24, "<br/>\n", 1 );
?>
Related examples in the same category