How to tell if a string contains characters in Hebrew using PHP?

前端 未结 3 994
我在风中等你
我在风中等你 2020-12-18 03:53

Trying to figure out how to tell whether a string contains any characters in Hebrew with no luck.

How can this be done?

3条回答
  •  被撕碎了的回忆
    2020-12-18 04:36

    If the source string is UTF-8 encoded, then the simpler approach would be using \p{Hebrew} in the regex.

    The call also should have the /u modifier.

     = preg_match("/\p{Hebrew}/u", $string)
    

提交回复
热议问题