更新时间:2023-02-21 11:25:19
使用 unicode 标志:
Use unicode flag:
$text = "الحمد لله رب العالمين";
echo $is_arabic = preg_match('/\p{Arabic}/u', $text);
here __^
如果你只想匹配阿拉伯语,你应该这样做:
If you want to match only arabic you should do:
echo $is_arabic = preg_match('/^[\s\p{Arabic}]+$/u', $text);