note 96967 deleted from function.mb-split by danbrown

From: Date: Thu, 25 Mar 2010 15:49:20 +0000
Subject: note 96967 deleted from function.mb-split by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167395@lists.php.net to get a copy of this message
Note Submitter: qdb at kukmara dot ru ---- 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); ?>

« previous php.notes (#167395) next »