note 96969 added to function.mb-split

From: Date: Thu, 25 Mar 2010 10:46:32 +0000
Subject: note 96969 added to function.mb-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-167383@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/96969 Del: integrated -- https://master.php.net/note/delete/96969/integrated Del: useless -- https://master.php.net/note/delete/96969/useless Del: bad code -- https://master.php.net/note/delete/96969/bad+code Del: spam -- https://master.php.net/note/delete/96969/spam Del: non-english -- https://master.php.net/note/delete/96969/non-english Del: in docs -- https://master.php.net/note/delete/96969/in+docs Del: other reasons-- https://master.php.net/note/delete/96969 Reject -- https://master.php.net/note/reject/96969 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167383) next »