note 98376 added to function.wordwrap
| From: | IvanLisnik at osu1 dot php dot net | Date: | Fri, 11 Jun 2010 10:26:11 +0000 |
| Subject: | note 98376 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170053@lists.php.net to get a copy of this message | ||
here is my example of UTF-8 wordwrap
<?php
function wordwrap($str, $width, $break)
{
$return = '';
$br_width = mb_strlen($break, 'UTF-8');
for($i = 0, $count = 0; $i < mb_strlen($str, 'UTF-8'); $i++, $count++)
{
if (mb_substr($str, $i, $br_width, 'UTF-8') == $break)
{
$count = 0;
$return .= mb_substr($str, $i, $br_width, 'UTF-8');
$i += $br_width - 1;
}
if ($count > $width)
{
$return .= $break;
$count = 0;
}
$return .= mb_substr($str, $i, 1, 'UTF-8');
}
return $return;
}
?>
----
Server IP: 89.190.194.18
Probable Submitter: 81.161.245.45
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/98376
Del: integrated -- https://master.php.net/note/delete/98376/integrated
Del: useless -- https://master.php.net/note/delete/98376/useless
Del: bad code -- https://master.php.net/note/delete/98376/bad+code
Del: spam -- https://master.php.net/note/delete/98376/spam
Del: non-english -- https://master.php.net/note/delete/98376/non-english
Del: in docs -- https://master.php.net/note/delete/98376/in+docs
Del: other reasons-- https://master.php.net/note/delete/98376
Reject -- https://master.php.net/note/reject/98376
Search -- https://master.php.net/manage/user-notes.php