I m trying to match the Hebrew banned words retrieved from the mysql db table with Hebrew string in $_POST['content']
, for English words (if used in Hebrew string $_POST['content']
) its giving the match but for Hebrew words no luck. Can you help me to modify the code below to search a banned Hebrew word in a given string? All the source of data has been checked its in UTF-8 format.
<?
$banned_words=array();
while($loc=mysql_fetch_array($loc_query))
{
$banned_words[$k]=stripslashes(utf8_decode($loc["sb_word"]));
$k=$k+1;
}
$matches = array();
$matchFound = preg_match_all(
"/\b(" . implode($banned_words,"|") . ")\b/u",
$_POST['content'],
$matches
);
if ($matchFound)
{
$words = array_unique($matches[0]);
$word_status=1;
}
?>