I'm having problems trying to compare two Arabic-language strings in a PHP script to see if they match. I've tried setting the internal encoding to UTF-8 with mb_internal_encoding, I've tried a simple if ($x == $y) expression, I've tried strcmp()... no dice. Any idea what I'm doing wrong? Does PHP have problems with doing string comparisons with non-English text?
Thanks!
Here is a code excerpt:
// Chop up HTML content into bits
$threadPieces = explode('</div>', $innerHTML);
// Chop up the HTML bits into data entries
$strippedThreadPieces = strip_tags($threadPieces[1]);
$threadInfo = explode('-', $strippedThreadPieces);
$threadTitleExists = trim($threadTitleExists, 'thread_title_');
$postername = "مراسل";
if (($threadTitleExists > 100000) && ($threadInfo[0] === $postername))
{
echo 'Thread title:';
echo strip_tags($threadPieces[0]);
echo '<p>';
}
else
{
}
I think the problem is the character set of your php file, try to save it using utf-8 character set.
The way I did this was using the function mb_ereg which is regular expression match with multibyte support.