PHP: How do I detect if an input string is Arabic

后端 未结 10 1382
旧时难觅i
旧时难觅i 2020-12-08 08:34

Is there a way to detect the language of the data being entered via the input field?

10条回答
  •  天命终不由人
    2020-12-08 08:42

    public static function isArabic($string){
        if(preg_match('/\p{Arabic}/u', $string))
            return true;
        return false;
    }
    

提交回复
热议问题