![]() |
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. Syntax:iconv_strlen(string $string, ?string $encoding = null) : int | false Parameters:
Return Value:The 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.
Output 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.
Output Length of '你好,世界!': 6 Length of 'Привет, мир!': 12 |
Reffered: https://www.geeksforgeeks.org
PHP |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |