xrwwgw
Last Updated: February 25, 2016
·
479
· jverdeyen
E40b946f8a5d22e9c61629df7ab0111c

mb_strlen for multibyte strings

php

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.

Say Thanks
Respond