PHP – mb_strlen to regain the size of a character chain and not strlen
Basic I've seen a lot of codes using strlen to recover a character chain size, unfortunately this method, returns the number of byte used rather than the number of characters. That is, based on your encoding, you're going to have differences of 1 character.
To avoid this, you could do:
strlen (utf8_encode($string))
But this uses two methods whereas the mb_strlen method automatically takes encoding into account
mb_strlen ($string)