Check unicode in PHP

前端 未结 6 475
予麋鹿
予麋鹿 2020-12-28 17:36

How can I check whether a character is a Unicode character or not with PHP?

6条回答
  •  别那么骄傲
    2020-12-28 18:24

    A unicode character will ALWAYS have the most significant byte set no matter what the value of the character is or if it's part of a multi-byte unicode character or what. You can't just check to see if the string has more bytes than characters since some unicode characters are only one byte. If any character in a string's byte value is greater than 127, that string contains unicode.

提交回复
热议问题