mbstrlen
mbstrlen is commonly used to refer to the multibyte string length function mb_strlen, which is provided by the mbstring extension in PHP. It counts the number of characters in a string rather than the number of bytes by interpreting the string according to a specified character encoding.
The function counts characters according to the given encoding. If no encoding is supplied, mb_strlen uses the
Syntax: mb_strlen(string $string, string|null $encoding = null)
Parameters: $string is the input string. $encoding is an optional encoding name, such as 'UTF-8', 'ISO-8859-1', or
Return value: The function returns an integer representing the number of characters in the string for the
Examples: mb_strlen('hello', 'UTF-8') returns 5. mb_strlen('こんにちは', 'UTF-8') returns 5, illustrating its multibyte awareness.
Notes: mb_strlen counts code points (characters) for the specified encoding, not grapheme clusters. For grapheme-aware length,
See also: strlen, mb_strpos, mb_substr, mb_strwidth, mb_detect_encoding.