stripos returns false when special characters is used

后端 未结 4 1616
名媛妹妹
名媛妹妹 2020-12-07 02:14

I am using the stripos function to check if a string is located inside another string, ignoring any cases.

Here is the problem:

stripos(\"ø\", \"Ø\")         


        
相关标签:
4条回答
  • 2020-12-07 02:28

    mb_stripos will take care of this.

    0 讨论(0)
  • 2020-12-07 02:32

    As the other solutions say, try first with mb_stripos(). But if using this function doesn't help, check the encoding of your php file. Convert it to UTF-8 and save it. That did the trick for me after hours of research.

    0 讨论(0)
  • 2020-12-07 02:49

    Use mb_stripos() instead. It's character set aware and will handle multi-byte character sets. stripos() is a holdover from the good old days when there was only ASCII and all chars were only 1 byte.

    0 讨论(0)
  • 2020-12-07 02:53

    You need mb_stripos.

    0 讨论(0)
提交回复
热议问题