Supply 1 as a fourth parameter, which enables "cut" modewords over the limit will be cut up if this is enabled.
<?
$text = "this is a test.this is a test.this is a test.this is a test.this is a test.this is a test.";
$text = wordwrap($text, 6, "\n", 1);
print $text;
?>