![]() |
VOOZH | about |
The iconv_strlen() is an inbuilt function in PHP that is used to calculate the length of a string. It is very useful when your working string is encoded in a different character set, as it can accurately determine the length regardless of the encoding.
iconv_strlen(string $string, ?string $encoding = null) : int | falseThe return value of the iconv_strlen() function is the length of the string. If this function fails to get the length of the string. It will return false.
Example 1: The following program demonstrates the iconv_strlen() function.
String Length is = 13
Example 2: The following program demonstrate the iconv_strlen() function. In this program, we will find the length of Chinese chracter and Russian language character.
Length of '你好,世界!': 6 Length of 'Привет, мир!': 12