note 64517 added to function.wordwrap
| From: | (dot) | Date: | Mon, 17 Apr 2006 13:29:50 +0000 |
| Subject: | note 64517 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108336@lists.php.net to get a copy of this message | ||
The function for wrapping strings without wrapping the html might need a second parameter (lenght):
<?php
function textWrap($text, $size = 90) {
$new_text = '';
$text_1 = explode('>',$text);
$sizeof = sizeof($text_1);
for ($i=0; $i<$sizeof; ++$i) {
$text_2 = explode('<',$text_1[$i]);
if (!empty($text_2[0])) {
$new_text .= preg_replace('#([^\n\r .]{'. $size .'})#i', '\\1 ',
$text_2[0]);
}
if (!empty($text_2[1])) {
$new_text .= '<' . $text_2[1] . '>';
}
}
return $new_text;
}
?>
----
Server IP: 194.239.128.8
Probable Submitter: 80.63.201.98
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- http://master.php.net/note/edit/64517
Del: integrated -- http://master.php.net/note/delete/64517/integrated
Del: useless -- http://master.php.net/note/delete/64517/useless
Del: bad code -- http://master.php.net/note/delete/64517/bad+code
Del: spam -- http://master.php.net/note/delete/64517/spam
Del: non-english -- http://master.php.net/note/delete/64517/non-english
Del: in docs -- http://master.php.net/note/delete/64517/in+docs
Del: other reasons-- http://master.php.net/note/delete/64517
Reject -- http://master.php.net/note/reject/64517
Search -- http://master.php.net/manage/user-notes.php