Last active
September 2, 2021 17:58
-
-
Save ahmadmarafa/8cfe27839623bf2b6b96e089a4b6fbdb to your computer and use it in GitHub Desktop.
Revisions
-
ahmadmarafa renamed this gist
Sep 2, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ahmadmarafa revised this gist
Jan 28, 2019 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,12 +17,13 @@ function arSoundex($string) } $string = preg_replace("/ي(?=\Z|\s)/","ى",$string); $latin = [ 'ال' => 'EL' , 'ا' => 'A', 'ب' => 'B' , 'ت' => 'T', 'ث' => 'T', 'ج' => 'J', 'ح' => 'H', 'خ' => 'KH', 'د' => 'D', 'ذ' => 'Z','ر' => 'R', 'ز' => 'Z', 'س'=> 'S', 'ش' => 'S', 'ص' => 'S', 'ض' => 'D', 'ط' => 'T', 'ظ' => 'Z', 'ع' => 'A', 'غ' => 'G','ف' => 'F', 'ق' => 'Q', 'ك' => 'CK','ل' => 'L','م' => 'M','ن' => 'N','ه' => 'H', 'و' => 'W', 'ى' => 'Y' ]; return soundex(strtr($string , $latin)); -
ahmadmarafa renamed this gist
Feb 13, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ahmadmarafa created this gist
Feb 13, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php /** this is a simple method , which will return soundex of transliterated arabic string */ function arSoundex($string) { // remove any pounctions and any space etc .. $string = preg_replace("/\\p{P}|\\p{M}/u", "" , $string); $chars = array( "ا"=>"أإاآ" , "و"=>"ؤ", "ه"=>"ة", ); foreach($chars as $with=>$replace) { $string = preg_replace("/[{$replace}]/u" , $with , $string); } $string = preg_replace("/ي(?=\Z|\s)/","ى",$string); $latin = [ 'ا' => 'A', 'ب' => 'B' , 'ت' => 'T', 'ث' => 'T', 'ج' => 'J', 'ح' => 'H', 'خ' => 'K', 'د' => 'D', 'ذ' => 'Z','ر' => 'R', 'ز' => 'Z', 'س' => 'S', 'ش' => 'S', 'ص' => 'S', 'ض' => 'D', 'ط' => 'T', 'ظ' => 'Z', 'ع' => 'A', 'غ' => 'G','ف' => 'F', 'ق' => 'Q','ك' => 'K','ل' => 'L','م' => 'M','ن' => 'N','ه' => 'H', 'و' => 'W','ي' => 'Y' ]; return soundex(strtr($string , $latin)); } ?>