note 113690 deleted from function.str-replace by mikemike
| From: | mikemike@php.net | Date: | Mon, 28 Apr 2014 15:29:07 +0000 |
| Subject: | note 113690 deleted from function.str-replace by mikemike | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199360@lists.php.net to get a copy of this message | ||
Note Submitter: omar dot technologies at gmail dot com
----
This is for arabic strings and names
I've written a small series of str_replace to standardize Arabic names when comparing one name
to another to find a match.
Because a name can be entered in many many ways, and if you're trying to compare an exact LIKE
or == .. if both the names aren't entered in the exactly written way, your comparison will
return a false, even though it might have been the same name.
This .. takes care of almost all possible exceptions.
function cleanArabicName($name)
{
$name =
str_replace(array("ا","Ø£","Ø¥","Ø¢","اÙ","اÙ","اÙ","اÙ","اÙ","اÙ"),"ا",$name);
$name = str_replace(array("Ù","Ø©"),"Ø©",$name);
$name = str_replace(array("Ù","Ù"),"Ù",$name);
$name = str_replace(array("Ù","ؤ"),"Ù",$name);
$name = str_replace(array("ئ","ء"),"ئ",$name);
$name = str_replace(array("Ù","Ù"),"",$name);
$name =
str_replace(array("ﻹ","ï»·","ï»»","ﻵ"),"ÙØ§",$name);
return $name;
}