Last Updated: February 25, 2016
·
680
· jverdeyen

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.