note 90925 added to function.strtr
| From: | allixsenos at gmail dot com | Date: | Sat, 16 May 2009 15:55:08 +0000 |
| Subject: | note 90925 added to function.strtr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154671@lists.php.net to get a copy of this message | ||
fixed "normaliza" functions written below to include Slavic Latin characters... also, it
doesn't return lowercase any more (you can easily get that by applying strtolower yourself)...
also, renamed to normalize()
<?php
function normalize ($string) {
$table = array(
'Å '=>'S', 'Å¡'=>'s',
'Ä'=>'Dj', 'Ä'=>'dj',
'Ž'=>'Z', 'ž'=>'z',
'Ä'=>'C', 'Ä'=>'c',
'Ä'=>'C', 'Ä'=>'c',
'Ã'=>'A', 'Ã'=>'A',
'Ã'=>'A', 'Ã'=>'A',
'Ã'=>'A', 'Ã
'=>'A',
'Ã'=>'A', 'Ã'=>'C',
'Ã'=>'E', 'Ã'=>'E',
'Ã'=>'E', 'Ã'=>'E',
'Ã'=>'I', 'Ã'=>'I',
'Ã'=>'I', 'Ã'=>'I',
'Ã'=>'N', 'Ã'=>'O',
'Ã'=>'O', 'Ã'=>'O',
'Ã'=>'O', 'Ã'=>'O',
'Ã'=>'O', 'Ã'=>'U',
'Ã'=>'U', 'Ã'=>'U',
'Ã'=>'U', 'Ã'=>'Y',
'Ã'=>'B', 'Ã'=>'Ss',
'à '=>'a', 'á'=>'a',
'â'=>'a', 'ã'=>'a',
'ä'=>'a', 'å'=>'a',
'æ'=>'a', 'ç'=>'c',
'è'=>'e', 'é'=>'e',
'ê'=>'e', 'ë'=>'e',
'ì'=>'i', 'Ã'=>'i',
'î'=>'i', 'ï'=>'i',
'ð'=>'o', 'ñ'=>'n',
'ò'=>'o', 'ó'=>'o',
'ô'=>'o', 'õ'=>'o',
'ö'=>'o', 'ø'=>'o',
'ù'=>'u', 'ú'=>'u',
'û'=>'u', 'ý'=>'y',
'ý'=>'y', 'þ'=>'b',
'ÿ'=>'y', 'Å'=>'R',
'Å'=>'r',
);
return strtr($string, $table);
}
?>
----
Server IP: 193.198.184.18
Probable Submitter: 93.136.18.181
----
Manual Page -- http://www.php.net/manual/en/function.strtr.php
Edit -- https://master.php.net/note/edit/90925
Del: integrated -- https://master.php.net/note/delete/90925/integrated
Del: useless -- https://master.php.net/note/delete/90925/useless
Del: bad code -- https://master.php.net/note/delete/90925/bad+code
Del: spam -- https://master.php.net/note/delete/90925/spam
Del: non-english -- https://master.php.net/note/delete/90925/non-english
Del: in docs -- https://master.php.net/note/delete/90925/in+docs
Del: other reasons-- https://master.php.net/note/delete/90925
Reject -- https://master.php.net/note/reject/90925
Search -- https://master.php.net/manage/user-notes.php