note 122433 deleted from function.strlen by cmb
| From: | cmb@php.net | Date: | Sun, 25 Jul 2021 14:17:28 +0000 |
| Subject: | note 122433 deleted from function.strlen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216655@lists.php.net to get a copy of this message | ||
Note Submitter: alireza moazami
----
if your text contain UTF8 character (arabic character for example), the mb_substr can use instead of
strlen.
but if the string contain UTF16 (wmoji, smily) then you can use this method to get correct length:
<?php echo strlen(iconv('utf-8', 'utf-16le',
'عÙÛðali'))/2;
because some emoji (ex: ð) is 2, 3 or 4 byte!