note 105189 deleted from function.chunk-split by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Aug 2011 14:56:43 +0000 |
| Subject: | note 105189 deleted from function.chunk-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182107@lists.php.net to get a copy of this message | ||
Note Submitter: devplayer at yahoo dot com
----
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