The php Function MB_Strlen
The php function mb_strlen (as multi-byte string length) is used to get the total number of characters in a specified string. This is a new function introduced in PHP 4.6.0 to replace the old strlen function that only returned the number of ASCII characters in a string.
This function accepts two parameters: the string and the character encoding. The encoding is used to determine which character set to use. If the encoding is omitted or null, then the internal character encoding value will be used. The return value is the number of characters present in the string. A multi-byte character is counted as one. If the encoding is not known, an error of level E_warning will be generated.
Another thing to note is that the speed of mb_strlen varies a lot depending on the specified character set. For example, it can be several times slower than using strlen in environments that use the utf8 charset.
It's best to avoid relying on the PHP STRLEN function in a production environment when you need to validate a string for length, especially if it's going to be used with a character set such as utf8 or other multi-byte character sets. Instead, use mb_strlen or an alternative such as the MB_STRLEN or ISSET functions. All of these are significantly faster than PHP STRLEN and they also offer more accurate results when working with Unicode strings. This is especially important when dealing with special characters like umlauts, etc.