note 88623 added to function.wordwrap
| From: | ace at osu1 dot php dot net | Date: | Sun, 01 Feb 2009 13:21:27 +0000 |
| Subject: | note 88623 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150058@lists.php.net to get a copy of this message | ||
function htmlwordwrap(&$text, $width = 10, $break = '<br />', $space = '
') {
$i = 0; $count = 0; $tag = false;
while ($i < strlen($text)) {
$char = substr($text, $i, 1);
if ($char == '<') {
$tag = true;
$count = 0;
} else if ($char == '>') {
$tag = false;
$count = 0;
}
else if ($char == $space) $count = 0;
else if (!$tag) $count++;
if ($count > $width) {
$text = substr($text, 0, $i) . $break . substr($text, $i);
$count = 0;
$i += strlen($break) - 1;
}
$i++;
}
return $text;
}
----
Server IP: 213.250.2.28
Probable Submitter: 84.255.246.202
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/88623
Del: integrated -- https://master.php.net/note/delete/88623/integrated
Del: useless -- https://master.php.net/note/delete/88623/useless
Del: bad code -- https://master.php.net/note/delete/88623/bad+code
Del: spam -- https://master.php.net/note/delete/88623/spam
Del: non-english -- https://master.php.net/note/delete/88623/non-english
Del: in docs -- https://master.php.net/note/delete/88623/in+docs
Del: other reasons-- https://master.php.net/note/delete/88623
Reject -- https://master.php.net/note/reject/88623
Search -- https://master.php.net/manage/user-notes.php