note 106405 added to function.chunk-split
| From: | txgruppiatgmaildotcom at osu1 dot php dot net | Date: | Mon, 07 Nov 2011 22:19:07 +0000 |
| Subject: | note 106405 added to function.chunk-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184320@lists.php.net to get a copy of this message | ||
My version of chunk_split for utf-8 string
<?php
function utf8_chunk_split($text, $length, $string_end) {
$text = iconv('utf-8', 'iso-8859-1', $text);
$text = str_split($text);
$new_text = '';
$c = 0;
foreach ($text as $char) {
if ($c >= $length) {
$new_text .= $string_end;
$c = 0;
}
$new_text .= $char;
$c++;
}
$new_text = iconv('iso-8859-1', 'UTF-8', $new_text);
return $new_text;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.83.186.157
----
Manual Page -- http://www.php.net/manual/en/function.chunk-split.php
Edit -- https://master.php.net/note/edit/106405
Del: integrated -- https://master.php.net/note/delete/106405/integrated
Del: useless -- https://master.php.net/note/delete/106405/useless
Del: bad code -- https://master.php.net/note/delete/106405/bad+code
Del: spam -- https://master.php.net/note/delete/106405/spam
Del: non-english -- https://master.php.net/note/delete/106405/non-english
Del: in docs -- https://master.php.net/note/delete/106405/in+docs
Del: other reasons-- https://master.php.net/note/delete/106405
Reject -- https://master.php.net/note/reject/106405
Search -- https://master.php.net/manage/user-notes.php