note 101050 added to function.chunk-split
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 23 Nov 2010 12:44:32 +0000 |
| Subject: | note 101050 added to function.chunk-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174281@lists.php.net to get a copy of this message | ||
<?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);
}
return $array;
}
function mb_chunk_split($str, $len, $glue) {
if (empty($str)) return false;
$array = mbStringToArray ($str);
$n = -1;
$new = '';
foreach ($array as $char) {
$n++;
if ($n < $len) $new .= $char;
elseif ($n == $len) {
$new .= $glue . $char;
$n = 0;
}
}
return $new;
}
----
Server IP: 69.147.83.197
Probable Submitter: 187.58.165.48
----
Manual Page -- http://www.php.net/manual/en/function.chunk-split.php
Edit -- https://master.php.net/note/edit/101050
Del: integrated -- https://master.php.net/note/delete/101050/integrated
Del: useless -- https://master.php.net/note/delete/101050/useless
Del: bad code -- https://master.php.net/note/delete/101050/bad+code
Del: spam -- https://master.php.net/note/delete/101050/spam
Del: non-english -- https://master.php.net/note/delete/101050/non-english
Del: in docs -- https://master.php.net/note/delete/101050/in+docs
Del: other reasons-- https://master.php.net/note/delete/101050
Reject -- https://master.php.net/note/reject/101050
Search -- https://master.php.net/manage/user-notes.php