格式语言阿拉伯语搜索文本


formatting langue arabic to search in text

我得到了twitter和facebook的评论

评论推特

'u0627'u0644'u0627'u062a'u062d'u0627'u062f 'u0627'

facebook评论

"&#x0645&#x0645&#x0643&#x0646 &#x0633&#x0648&#x0627&#x0644 &#x064a&#x0627 &#x0645&#x0647&#x0646&#x062f&#x0633"

我在我的两个注释中搜索字符串صباح是否存在我使用这段代码但是当它完成时返回false

$texte='blabla arab';//cam from data base
$name="صباح";//my string to search
if (function_exists('grapheme_strpos')) {
            $pos = grapheme_strpos($texte, $name);
        } elseif (function_exists('mb_strpos')) {
            $pos = mb_strpos($texte, $name);
        } else {
            $pos = strpos($texte, $name);
        }
        if ($pos !== false)
            echo 'yes';

我如何在facebook和twitter的所有评论cam中搜索我的字符串?

1-你应该解释你的函数做什么,因为它可能默认返回false或逻辑错误

2-使用此函数Preg_match ($pattern, $subject, $matches);模式是"/صباح/"这样的:

       $strings="تم اكل الدجاجه صباح الجمعه";
$pattern="/صباح/";
$replacement="ص";
$search =preg_match($pattern, $strings);
if($search ==1){
 echo "yes! it's here!";
}else{
echo "No!, it's not here!";
}
//if you want to replace the statement you can use this function  
$strings=preg_replace($pattern, $replacement,$strings);
echo $strings;
//The result will be : 
//تم اكل الدجاجه صباح الجمعه