Faced a problem when the string is in Russian, the strpos($txt," "); method strpos($txt," "); returns wrong character position

for example, $ txt = "MySQL Cluster Supports"

echo $ start = strpos ($ txt, "");

returns 5 and if the variable $ txt = "Assign Russian characters" returns something completely wrong!

what is the problem?

  • what did you write yourself? - Artem
  • and what exactly is not clear? - snaipi91

2 answers 2

utf-8 encoding, it's all about it. for the correct iteration mb_strpos, and if you come across in order to find out the length of the string in Russian, use mb_strlen ()

    mb_strpos