I get comment from twitter and facebook
Comment twitter
\u0627\u0644\u0627\u062a\u062d\u0627\u062f \u0627\
comment from facebook
"ممكن سوال يا مهندس"
and I went search string in my two comment صباح
if exist or not I use this code but when hi finiched shi return 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';
how can I search my string in all comment cam from facebook and twitter?
1- you should explain what your function do, because may it return false by default or by a logic error
2- use this function preg_match($pattern, $subject, $matches); and the pattern is "/صباح/" Like this:
$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 :
//تم اكل الدجاجه صباح الجمعه