Text
|
|
|
|
<?php function wrap_text($text, $wrap) {
$wrap -= 2; //wrapped phrase is started and ended by a char
preg_match_all("/bw.{1,$wrap}wb/",$text,$parts);
return (implode("<br>", $parts[0]));
} ?>
|
|
|
Usage Example
|
$phrase = "This is a very long string only with spaces, alphanumerics, it takes over 72 characters on a single line, it should be wrapped";
print $phrase . "<br>";
print (wrap_text($phrase, 14));
|
|
|
Rate This Script
|
|
|
|