如何使用PHP判断字符串是否包含希伯来语中的字符? [英] How to tell if a string contains characters in Hebrew using PHP?

查看:113
本文介绍了如何使用PHP判断字符串是否包含希伯来语中的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图弄清楚如何判断一个字符串是否包含希伯来语中的任何个字符,而没有运气.

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

这怎么办?

推荐答案

如果源字符串是UTF-8编码的,那么更简单的方法是使用

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

该调用还应该具有/u修饰符.

The call also should have the /u modifier.

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

这篇关于如何使用PHP判断字符串是否包含希伯来语中的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆