note 88518 added to function.wordwrap
| From: | g---mailco dot dot mlolblah at phueina dot dot t | Date: | Tue, 27 Jan 2009 19:39:34 +0000 |
| Subject: | note 88518 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149857@lists.php.net to get a copy of this message | ||
znupiDONTWANTSPAM69 at gmail dot comBLAH
24-Feb-2008 06:05
gave a nice good function that I converted into utf-8 for my needs :+D
Thank you dude!
Here's my version of it:
function layout_wrap($str, $i)
{
$j = $i;
$length = mb_strlen($str, 'UTF-8');
while ($i < $length)
{
if (mb_strpos($str, ' ', $i-$j+1, 'UTF-8') > $i+$j ||
mb_strpos($str, ' ', $i-$j+1, 'UTF-8') === false)
{
$str = mb_substr($str, 0, $i, 'UTF-8') . ' ' . mb_substr($str, $i,
$length,'UTF-8');
}
$i += $j;
}
return $str;
}
I hope I didn't screw things up. Seems to work for me. I'm rather a noob, so do mind.
----
Server IP: 82.80.248.162
Probable Submitter: 89.138.21.58
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/88518
Del: integrated -- https://master.php.net/note/delete/88518/integrated
Del: useless -- https://master.php.net/note/delete/88518/useless
Del: bad code -- https://master.php.net/note/delete/88518/bad+code
Del: spam -- https://master.php.net/note/delete/88518/spam
Del: non-english -- https://master.php.net/note/delete/88518/non-english
Del: in docs -- https://master.php.net/note/delete/88518/in+docs
Del: other reasons-- https://master.php.net/note/delete/88518
Reject -- https://master.php.net/note/reject/88518
Search -- https://master.php.net/manage/user-notes.php