note 96967 added to function.mb-split
| From: | qdb at kukmara dot ru | Date: | Thu, 25 Mar 2010 10:45:29 +0000 |
| Subject: | note 96967 added to function.mb-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167381@lists.php.net to get a copy of this message | ||
an other way to str_split multibyte string:
<?php
$s='ÓÓÓ©Ò¯ÒÒ£Ò»';
//$temp_s=iconv('UTF-8','UTF-16',$s);
$temp_s=mb_convert_encoding($s,'UTF-16','UTF-8');
$temp_a=str_split($temp_s,4);
$temp_a_len=count($temp_a);
for($i=0;$i<$temp_a_len;$i++){
//$temp_a[$i]=iconv('UTF-16','UTF-8',$temp_a[$i]);
$temp_a[$i]=mb_convert_encoding($temp_a[$i],'UTF-8','UTF-16');
}
echo('<pre>');
print_r($temp_a);
echo('</pre>');
//also possible to directly use UTF-16:
define('SLS',mb_convert_encoding('/','UTF-16'));
$temp_s=mb_convert_encoding($s,'UTF-16','UTF-8');
$temp_a=str_split($temp_s,4);
$temp_s=implode(SLS,$temp_a);
$temp_s=mb_convert_encoding($temp_s,'UTF-8','UTF-16');
echo($temp_s);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 78.138.176.205
----
Manual Page -- http://www.php.net/manual/en/function.mb-split.php
Edit -- https://master.php.net/note/edit/96967
Del: integrated -- https://master.php.net/note/delete/96967/integrated
Del: useless -- https://master.php.net/note/delete/96967/useless
Del: bad code -- https://master.php.net/note/delete/96967/bad+code
Del: spam -- https://master.php.net/note/delete/96967/spam
Del: non-english -- https://master.php.net/note/delete/96967/non-english
Del: in docs -- https://master.php.net/note/delete/96967/in+docs
Del: other reasons-- https://master.php.net/note/delete/96967
Reject -- https://master.php.net/note/reject/96967
Search -- https://master.php.net/manage/user-notes.php