note 45407 added to function.strlen
| From: | chernyshevsky at hotmail dot com | Date: | Sun, 05 Sep 2004 22:36:44 +0000 |
| Subject: | note 45407 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76079@lists.php.net to get a copy of this message | ||
The easiest way to determine the character count of a UTF8 string is to pass the text through
utf8_decode() first:
$length = strlen(utf8_decode($s));
utf8_decode() converts characters that are not in ISO-8859-1 to '?', which, for the
purpose of counting, is quite alright.
----
Manual Page -- http://www.php.net/manual/en/function.strlen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45407
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45407&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45407&report=yes
Search -- http://master.php.net/manage/user-notes.php