note 113213 added to function.mb-strwidth
| From: | chiangtor at gmail dot com | 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