note 80926 added to function.mb-strwidth
| From: | larry1chan at gmail dot com | Date: | Thu, 07 Feb 2008 06:38:59 +0000 |
| Subject: | note 80926 added to function.mb-strwidth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135841@lists.php.net to get a copy of this message | ||
to convert a multi-byte character into hex strings:
$b =
"ç¾ï¼å¸æ°æ´¾å©å¸çç¿æ
£äº¦æææ¹è®";
printf("length of string: %d <br>", mb_strlen($b, 'UTF-8'));
for ($i=0; $i < mb_strlen($b, 'UTF-8'); $i++){
$ch = mb_substr($b, $i, 1, 'UTF-8');
$chlen = mb_strwidth($ch, 'UTF-8');
$hexs = '';
for ($j=0; $j < $chlen; $j++)
$hexs = $hexs . sprintf("%x", ord($ch[$j]));
printf ("width=%d => '%s' |hex=%s<br>", $chlen, $ch, $hexs );
}
----
Server IP: 58.65.236.81
Probable Submitter: 219.79.59.151
----
Manual Page -- http://www.php.net/manual/en/function.mb-strwidth.php
Edit -- https://master.php.net/note/edit/80926
Del: integrated -- https://master.php.net/note/delete/80926/integrated
Del: useless -- https://master.php.net/note/delete/80926/useless
Del: bad code -- https://master.php.net/note/delete/80926/bad+code
Del: spam -- https://master.php.net/note/delete/80926/spam
Del: non-english -- https://master.php.net/note/delete/80926/non-english
Del: in docs -- https://master.php.net/note/delete/80926/in+docs
Del: other reasons-- https://master.php.net/note/delete/80926
Reject -- https://master.php.net/note/reject/80926
Search -- https://master.php.net/manage/user-notes.php