note 113690 added to function.str-replace
| From: | omar dot technologies at gmail dot com | Date: | Sat, 16 Nov 2013 17:52:18 +0000 |
| Subject: | note 113690 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197540@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/113690
Del: integrated -- https://master.php.net/note/delete/113690/integrated
Del: useless -- https://master.php.net/note/delete/113690/useless
Del: bad code -- https://master.php.net/note/delete/113690/bad+code
Del: spam -- https://master.php.net/note/delete/113690/spam
Del: non-english -- https://master.php.net/note/delete/113690/non-english
Del: in docs -- https://master.php.net/note/delete/113690/in+docs
Del: other reasons-- https://master.php.net/note/delete/113690
Reject -- https://master.php.net/note/reject/113690
Search -- https://master.php.net/manage/user-notes.php