note 113690 deleted from function.str-replace by mikemike

From: 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; }

« previous php.notes (#199360) next »