note 71844 added to function.wordwrap
| From: | Peter at osu1 dot php dot net | Date: | Tue, 19 Dec 2006 13:00:18 +0000 |
| Subject: | note 71844 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120764@lists.php.net to get a copy of this message | ||
The main concern when you have a text in a cell is for long words that drags the cell margins. This
function will break words in a text that have more then $nr characters using the "-" char.
function processtext($text,$nr=10)
{
$mytext=explode(" ",trim($text));
$newtext=array();
foreach($mytext as $k=>$txt)
{
if (strlen($txt)>$nr)
{
$txt=wordwrap($txt, $nr, "-", 1);
}
$newtext[]=$txt;
}
return implode(" ",$newtext);
}
----
Server IP: 66.163.161.117
Probable Submitter: 82.76.38.239
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/71844
Del: integrated -- https://master.php.net/note/delete/71844/integrated
Del: useless -- https://master.php.net/note/delete/71844/useless
Del: bad code -- https://master.php.net/note/delete/71844/bad+code
Del: spam -- https://master.php.net/note/delete/71844/spam
Del: non-english -- https://master.php.net/note/delete/71844/non-english
Del: in docs -- https://master.php.net/note/delete/71844/in+docs
Del: other reasons-- https://master.php.net/note/delete/71844
Reject -- https://master.php.net/note/reject/71844
Search -- https://master.php.net/manage/user-notes.php