note 65150 deleted from function.wordwrap by bjori
| From: | bjori@php.net | Date: | Tue, 25 Apr 2006 19:17:50 +0000 |
| Subject: | note 65150 deleted from function.wordwrap by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109681@lists.php.net to get a copy of this message | ||
Note Submitter: barnet at gmx dot at
Reason: useless
----
This works too (as an alternative):
<?php
function wrapit($text,$maxlength,$spacer)
{
$textarr=explode(" ",$text);
$i=0;
foreach($textarr as $textpart)
{
if (strlen($textpart) > $maxlength)$textarr[$i]= chunk_split($textpart,$maxlength,$spacer);
$i++;
}
$text=implode (" ",$textarr);
return $text;
}
?>
Instead of eg.
<?php
$comment=@wordwrap($comment, 52, " ", 1);
?>
simply write:
<?php
$comment=$wrapit($comment, 52, " ");
?>