mb_strlen for multibyte strings
If you are using strlen() on a multibyte string then you might get a wrong result, if you want to know the number of characters used.
Instead use mb_strlen(), it will count the multibyte chars as 1 char.
mb_strlen is slower than strlen(), but safer if you're expecting exotic characters.
Written by Joeri Verdeyen
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Related Tags
#php
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#