iconv_strlen
Description
The iconv_strlen of iconv for PHP returns the character count of string.
Syntax
iconv_strlen( string $string, ?string $encoding = null ): int|false
Parameters
string
The string.
encoding
If encoding parameter is omitted or null, string is assumed to be encoded in iconv.internal_encoding.
Return
Returns the character count of string, as an integer, or false if an error occurs during the encoding.
Examples
1 · string
<? $string = "string·"; $return = iconv_strlen($string); echo $return;
7
2 · encoding
<? $string = "string·"; $encoding = "ISO-8859-1"; $return = iconv_strlen($string, $encoding); echo $return;
8