2015-07-09 64 views
0

SEACH我得到的评论来自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" 

和我去搜索字符串在我的两个评论صباح如果存在或不存在我使用此代码但是嗨时fin shi回复虚假

$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的所有评论凸轮搜索我的字符串?

英语不是我的母语,对于任何错误感到抱歉。

回答

2

1-你应该解释一下你的函数做什么,因为它可以在默认情况下或逻辑错误

2 - 使用此功能 的preg_match($模式,$主题,$匹配)返回false; 和模式是“/صباح/” 像这样:

 $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 : 
//تم اكل الدجاجه صباح الجمعه