note 122433 deleted from function.strlen by cmb

From: 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!

« previous php.notes (#216655) next »