我得到了twitter和facebook的评论
评论推特
'u0627'u0644'u0627'u062a'u062d'u0627'u062f 'u0627'
facebook评论
"ممكن سوال يا مهندس"
我在我的两个注释中搜索字符串صباح
是否存在我使用这段代码但是当它完成时返回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 :
//تم اكل الدجاجه صباح الجمعه