note 42383 added to function.strtoupper
| From: | (webmaster--@--zeyus--dot--com) | Date: | Fri, 14 May 2004 05:18:09 +0000 |
| Subject: | note 42383 added to function.strtoupper | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69595@lists.php.net to get a copy of this message | ||
Just a comment on Jose Roberto Kerne's script (which should work perfectly), it should be able
to be cut down to this, as str_replace accepts array values (as of ??? php version), the only
difference is this should be quicker and obviously array values could be replaced with any
characters (or sets of strings) you want to be replaced
<?php
function stringUpDown($text, $up = true){
# Convert values from Lower to Upper
$arrayLower=array('ç'
,'â','ã','à','á','ä'
,'é','è','ê','ë'
,'í','ì','î','ï'
,'ó','ò','ô','õ','ö'
,'ú','ù','û','ü');
$arrayUpper=array('Ç'
,'Â','Ã','Á','À','Ä'
,'É','È','Ê','Ë'
,'Í','Ì','Î','Ï'
,'Ó','Ò','Õ','Ô','Ö'
,'Ú','Ù','Û','Ü');
if($text == ''){
return $text;
}
if($up != true) {
$text=strtolower($text);
$text=str_replace($arrayUpper, $arrayLower, $text);
}else{
$text=strtoupper($text);
$text=str_replace($arrayLower, $arrayUpper, $text);
}
return($text);
} #end of function
?>
----
Manual Page -- http://www.php.net/manual/en/function.strtoupper.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42383
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42383&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42383&report=yes
Search -- http://master.php.net/manage/user-notes.php