PHP and UTF-8 String functions WITHOUT MB-Functions?

Solution:

strlen() will return the length of the string in bytes by default, not characters… you can change this by setting the mbstring.func_overload ini setting to tell PHP to return characters from a strlen() call instead…. but this is global, and affects a number of other functions as well, like strpos() and substr() (full list in the documentation link)

This can have serious adverse effects elsewhere in your code, particularly if you’re using 3rd party libraries that aren’t aware of it, so it isn’t recommended.

It’s better to use the mb_* functions if you know that you’re working with UTF-8 strings… and (when it comes to it) setting the mbstring.func_overload is simply telling PHP to use mb_* functions as an alternative to the normal string functions “under the hood”