strlen() and UTF-8 encoding

前端 未结 6 1591
挽巷
挽巷 2020-12-05 20:19

Assuming UTF-8 encoding, and strlen() in PHP, is it possible that this string has a length of 4?

I\'m only interested to know about strlen(), not other functions

6条回答
  •  没有蜡笔的小新
    2020-12-05 21:06

    how about using mb_strlen() ?

    http://lt.php.net/manual/en/function.mb-strlen.php

    But if you need to use strlen, its possible to configure your webserver by setting mbstring.func_overload directive to 2, so it will automatically replace using of strlen to mb_strlen in your scripts.

提交回复
热议问题