note 50138 added to function.wordwrap
| From: | root at iltsalo dot ath dot cx | Date: | Sat, 19 Feb 2005 11:32:14 +0000 |
| Subject: | note 50138 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85232@lists.php.net to get a copy of this message | ||
Function who wrap words too long :
<?php
function wrap_string($string, $max, $limit=-1) {
if ($limit === -1) { $limit = $max; }
$exp = explode(' ', $string);
foreach($exp as $k => $value) {
if (strlen($value) > $max) {
$exp[$k] = wordwrap($value, $limit, " ", TRUE);
}
}
$string = implode(' ', $exp);
return $string;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50138
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50138&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50138&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50138&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50138&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50138&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50138&report=yes
Search -- http://master.php.net/manage/user-notes.php