note 83053 added to function.chunk-split
| From: | timatweirdspotsinmycrotchdotcom at osu1 dot php dot net | Date: | Thu, 08 May 2008 09:29:38 +0000 |
| Subject: | note 83053 added to function.chunk-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139172@lists.php.net to get a copy of this message | ||
@Royce
I think this is better, since you can still use the ampersand in your text:
<?php
function HtmlEntitySafeSplit($html,$size,$delim)
{
$pos=0;
for($i=0;$i<strlen($html);$i++)
{
if($pos >= $size && !$unsafe)
{
$out.=$delim;
$unsafe=0;
$pos=0;
}
$c=substr($html,$i,1);
if($c == "&")
$unsafe=1;
elseif($c == ";")
$unsafe=0;
elseif($c == " ")
$unsafe=0;
$out.=$c;
$pos++;
}
return $out;
}
?>
----
Server IP: 89.248.170.61
Probable Submitter: 82.204.15.202
----
Manual Page -- http://www.php.net/manual/en/function.chunk-split.php
Edit -- https://master.php.net/note/edit/83053
Del: integrated -- https://master.php.net/note/delete/83053/integrated
Del: useless -- https://master.php.net/note/delete/83053/useless
Del: bad code -- https://master.php.net/note/delete/83053/bad+code
Del: spam -- https://master.php.net/note/delete/83053/spam
Del: non-english -- https://master.php.net/note/delete/83053/non-english
Del: in docs -- https://master.php.net/note/delete/83053/in+docs
Del: other reasons-- https://master.php.net/note/delete/83053
Reject -- https://master.php.net/note/reject/83053
Search -- https://master.php.net/manage/user-notes.php