strlen()
function in php could not return correctly string lenght of utf8 chars, for example ????
is 4 char but after using strlen thats return 8 chr
<?php
echo strlen('????');
?>
See Question&Answers more detail:osstrlen()
function in php could not return correctly string lenght of utf8 chars, for example ????
is 4 char but after using strlen thats return 8 chr
<?php
echo strlen('????');
?>
See Question&Answers more detail:osThe core PHP string functions all assume 1 character = 1 byte. They have no concept of different encodings. To figure out how many characters are in a UTF-8 string (not how many bytes), use the mb_strlen
equivalent and tell it what encoding the string is in:
echo mb_strlen('????', 'UTF-8');