note 33625 deleted from function.str-replace by nlopess
| From: | nlopess@php.net | Date: | Mon, 12 Apr 2004 16:39:34 +0000 |
| Subject: | note 33625 deleted from function.str-replace by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68024@lists.php.net to get a copy of this message | ||
Note Submitter: kerxen@caramail.com Eddy Cingala
----
Here is a version of the CONVERSION "TO LOWER" and "TO UPPER" CASE.
I post it because I saw some functions that don't work.
At first, we replace the special charactères.
Then we use the basic PHP functions like strToUpper and strToLower.
function toUpper ($text) {
$lower = array
('à','á','â','ã','ä','å','æ','ç',
'è','é','ê','ë','ì','í','î','ï',
'ð','ñ','ò','ó','ô','õ','ö','÷'
,'ø','ù','ü','ú','þ','ÿ');
$upper = array
('À','Á','Â','Ã','Ä','Å','Æ','Ç',
'È','É','Ê','Ë','Ì','Í','Î','Ï',
'Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×'
,'Ø','Ù','Ü','Ú','Þ','ß');
$text = str_replace($lower, $upper,$text);
return strToUpper($text);
}
function toLower ($text) {
$lower = array
('à','á','â','ã','ä','å','æ','ç'
,'è','é','ê','ë','ì','í','î','ï',
'ð','ñ','ò','ó','ô','õ','ö',
'÷','ø','ù','ü','ú','þ','ÿ');
$upper = array
('À','Á','Â','Ã','Ä','Å','Æ','Ç'
,'È','É','Ê','Ë','Ì','Í','Î','Ï',
'Ð','Ñ','Ò','Ó','Ô','Õ','Ö',
'×','Ø','Ù','Ü','Ú','Þ','ß');
$text = str_replace($upper,$lower, $text);
return strToLower($text);
}