YouTip LogoYouTip

Func String Mb_Strlen

# PHP mb_strlen() Function [![Image 3: PHP String Reference](#) PHP String Reference](#) ## Example The function returns the length of the string "": ```php The output is: 10 18 * * * ## Definition and Usage The `mb_strlen()` function returns the length of a string. Unlike (#), it can return the corresponding character count by setting the character encoding, effectively handling the length issue of Chinese strings. To use `mb_strlen`, the `mbstring` extension must be enabled. * * * ## Syntax ```php mb_strlen(string $string, ?string $encoding = null): int `mb_strlen()` is used to get the length of a string. | Parameter | Description | | :--- | :--- | | _string_ | Required. The string to be checked. | | _encoding_ | Optional. The character encoding. If omitted, the internal character encoding is used. | ## Technical Details | Return Value: | Returns the length of the string on success, or 0 if the string is empty. | | :--- | | PHP Version: | 4+ | * * PHP String Reference](#) [](#)(#) (#)[](#) ### Share Notes
← Rust SetupOs File Methods β†’