note 97058 added to function.wordwrap
| From: | homer2k at gmx dot net | Date: | Tue, 30 Mar 2010 12:31:22 +0000 |
| Subject: | note 97058 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167524@lists.php.net to get a copy of this message | ||
A function that considers URIs.
<?php
function wordwrapURI($str, $width = 75, $break = "\n", $cut = false)
{
$newText = array();
$words = explode(' ', str_replace("\n", "\n ", $str));
foreach($words as $word) {
if(strpos($word, 'http://') === false &&
strpos($word, 'www.') === false) {
$word = wordwrap($word, $width, $break, $cut);
}
$newText[] = $word;
}
return implode(' ', $newText);
}
?>
----
Server IP: 85.214.154.209
Probable Submitter: 92.202.8.27
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/97058
Del: integrated -- https://master.php.net/note/delete/97058/integrated
Del: useless -- https://master.php.net/note/delete/97058/useless
Del: bad code -- https://master.php.net/note/delete/97058/bad+code
Del: spam -- https://master.php.net/note/delete/97058/spam
Del: non-english -- https://master.php.net/note/delete/97058/non-english
Del: in docs -- https://master.php.net/note/delete/97058/in+docs
Del: other reasons-- https://master.php.net/note/delete/97058
Reject -- https://master.php.net/note/reject/97058
Search -- https://master.php.net/manage/user-notes.php