note 88450 added to function.wordwrap
| From: | nightfall at example dot com | Date: | Sun, 25 Jan 2009 00:30:53 +0000 |
| Subject: | note 88450 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149740@lists.php.net to get a copy of this message | ||
<?php
function mb_wrap($string, $length = 75, $break = "\n", $encoding = 'UTF-8')
{
$para = mb_split($break, $string);
$string = '';
while (count($para)) {
$list = mb_split(' ', array_shift($para));
$len = 0;
while (count($list)) {
$line = array_shift($list);
$l = mb_strlen($line, $encoding);
if ($len + 1 + $l <= $length) {
$string .= ($len ? ' ' : '').$line;
$len += 1 + $l;
} else {
$string .= $break.$line;
if ($l > $length) {
$string .= $break;
$len = 0;
} else
$len = $l;
}
}
if (count($para)) $string .= $break;
}
return $string;
}
?>
----
Server IP: 91.196.196.205
Probable Submitter: 82.193.115.211
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/88450
Del: integrated -- https://master.php.net/note/delete/88450/integrated
Del: useless -- https://master.php.net/note/delete/88450/useless
Del: bad code -- https://master.php.net/note/delete/88450/bad+code
Del: spam -- https://master.php.net/note/delete/88450/spam
Del: non-english -- https://master.php.net/note/delete/88450/non-english
Del: in docs -- https://master.php.net/note/delete/88450/in+docs
Del: other reasons-- https://master.php.net/note/delete/88450
Reject -- https://master.php.net/note/reject/88450
Search -- https://master.php.net/manage/user-notes.php