note 105189 added to function.chunk-split
| From: | devplayer at yahoo dot com | Date: | Tue, 02 Aug 2011 10:23:43 +0000 |
| Subject: | note 105189 added to function.chunk-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182090@lists.php.net to get a copy of this message | ||
I've tried using Peter from dezzignz's function with my UTF-8 encoded strings, but it did
not work.
I had to change the mbStringToArray function to this:
<?php
function mbStringToArray($str) {
if (empty($str)) return false;
$len = mb_strlen($str);
$array = array();
for ($i = 0; $i < $len; $i++) {
$array[] = mb_substr($str, $i, 1, "UTF-8");
}
return $array;
}
?>
that is, i needed to add the encoding (UTF-8) at the 'mb_substr' function - the default
may be different than your string's encoding
----
Server IP: 69.147.83.197
Probable Submitter: 79.115.186.219
----
Manual Page -- http://www.php.net/manual/en/function.chunk-split.php
Edit -- https://master.php.net/note/edit/105189
Del: integrated -- https://master.php.net/note/delete/105189/integrated
Del: useless -- https://master.php.net/note/delete/105189/useless
Del: bad code -- https://master.php.net/note/delete/105189/bad+code
Del: spam -- https://master.php.net/note/delete/105189/spam
Del: non-english -- https://master.php.net/note/delete/105189/non-english
Del: in docs -- https://master.php.net/note/delete/105189/in+docs
Del: other reasons-- https://master.php.net/note/delete/105189
Reject -- https://master.php.net/note/reject/105189
Search -- https://master.php.net/manage/user-notes.php