note 82546 added to function.chunk-split

From: Date: Wed, 16 Apr 2008 07:31:19 +0000
Subject: note 82546 added to function.chunk-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-138349@lists.php.net to get a copy of this message
Here's a version of Chunk Split I wrote that will not split html entities. Useful if you need to inject something in html (in my case, <wbr/> tags to allow for long text wrapping). <?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; $out.=$c; $pos++; } return $out; } ?> ---- Server IP: 194.153.94.10 Probable Submitter: 203.211.141.174 ---- Manual Page -- http://www.php.net/manual/en/function.chunk-split.php Edit -- https://master.php.net/note/edit/82546 Del: integrated -- https://master.php.net/note/delete/82546/integrated Del: useless -- https://master.php.net/note/delete/82546/useless Del: bad code -- https://master.php.net/note/delete/82546/bad+code Del: spam -- https://master.php.net/note/delete/82546/spam Del: non-english -- https://master.php.net/note/delete/82546/non-english Del: in docs -- https://master.php.net/note/delete/82546/in+docs Del: other reasons-- https://master.php.net/note/delete/82546 Reject -- https://master.php.net/note/reject/82546 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138349) next »