note 113213 added to function.mb-strwidth

From: Date: Fri, 13 Sep 2013 03:30:22 +0000
Subject: note 113213 added to function.mb-strwidth
Groups: php.notes 
Request: Send a blank email to php-notes+get-196247@lists.php.net to get a copy of this message
to convert a multi-byte character into hex strings: <?php $b = "現,市民派利市的習慣亦有所改變"; printf("length of string: %d \n", mb_strlen($b, 'UTF-8')); for ($i=0; $i < mb_strlen($b, 'UTF-8'); $i++){ $ch = mb_substr($b, $i, 1, 'UTF-8'); $chlen = strlen($ch); $hexs = ''; for ($j=0; $j < $chlen; $j++) $hexs = $hexs . sprintf("%x", ord($ch[$j])); printf ("width=%d => '%s' |hex=%s\n", $chlen, $ch, $hexs ); } ?> width=3 => '現' |hex=e78fbe width=3 => ',' |hex=efbc8c width=3 => '市' |hex=e5b882 width=3 => '民' |hex=e6b091 width=3 => '派' |hex=e6b4be width=3 => '利' |hex=e588a9 width=3 => '市' |hex=e5b882 width=3 => '的' |hex=e79a84 width=3 => '習' |hex=e7bf92 width=3 => '慣' |hex=e685a3 width=3 => '亦' |hex=e4baa6 width=3 => '有' |hex=e69c89 width=3 => '所' |hex=e68980 width=3 => '改' |hex=e694b9 width=3 => '變' |hex=e8ae8a ---- Server IP: 69.147.83.199 Probable Submitter: 174.139.117.242 ---- Manual Page -- http://php.net/manual/en/function.mb-strwidth.php Edit -- https://master.php.net/note/edit/113213 Del: integrated -- https://master.php.net/note/delete/113213/integrated Del: useless -- https://master.php.net/note/delete/113213/useless Del: bad code -- https://master.php.net/note/delete/113213/bad+code Del: spam -- https://master.php.net/note/delete/113213/spam Del: non-english -- https://master.php.net/note/delete/113213/non-english Del: in docs -- https://master.php.net/note/delete/113213/in+docs Del: other reasons-- https://master.php.net/note/delete/113213 Reject -- https://master.php.net/note/reject/113213 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196247) next »