Reputation: 25274
It is UTF-8. For example, 情報 is 2 characters while ラリー ペイジ is 6 characters.
Upvotes: 3
Views: 201
Reputation: 3902
Even if the second argument of mb_strlen is said optional, it is actually needed, even if your internal encoding and your string's one are the same, for portability purposes.
mb_strlen('情報', 'UTF-8');
The same applies for most multi-byte functions, including mb_substr, for wich the utf8_decode option would not work at all.
Upvotes: 0
Reputation: 10200
Code
$a = "情報";
$b = "ラリーペイジ";
echo mb_strlen($a, 'UTF-8') . "\n";
echo mb_strlen($b, 'UTF-8') . "\n";
Result
2
6
Upvotes: 4
Reputation: 91892
Use mb_strlen för multibyte character encodings like UTF-8.
Upvotes: 0