note 78498 added to function.strtoupper
| From: | silent at gmx dot li | Date: | Mon, 15 Oct 2007 12:25:02 +0000 |
| Subject: | note 78498 added to function.strtoupper | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131395@lists.php.net to get a copy of this message | ||
ISO-8859-1 (Latin 1) full with all special characters:
<?php
function fullUpper($str){
// convert to entities
$subject = htmlentities($str,ENT_QUOTES);
$pattern = '/&([a-z])(uml|acute|circ';
$pattern.= '|tilde|ring|elig|grave|slash|horn|cedil|th);/e';
$replace =
"'&'.strtoupper('\\1').'\\2'.';'";
$result = preg_replace($pattern, $replace, $subject);
// convert from entities back to characters
$htmltable = get_html_translation_table(HTML_ENTITIES);
foreach($htmltable as $key => $value) {
$result = ereg_replace(addslashes($value),$key,$result);
}
return(strtoupper($result));
}
echo fullUpper("try this: äöüÃ");
?>
results in
TRY THIS: ÃÃÃÃ
----
Server IP: 217.160.72.57
Probable Submitter: 84.147.248.236
----
Manual Page -- http://www.php.net/manual/en/function.strtoupper.php
Edit -- https://master.php.net/note/edit/78498
Del: integrated -- https://master.php.net/note/delete/78498/integrated
Del: useless -- https://master.php.net/note/delete/78498/useless
Del: bad code -- https://master.php.net/note/delete/78498/bad+code
Del: spam -- https://master.php.net/note/delete/78498/spam
Del: non-english -- https://master.php.net/note/delete/78498/non-english
Del: in docs -- https://master.php.net/note/delete/78498/in+docs
Del: other reasons-- https://master.php.net/note/delete/78498
Reject -- https://master.php.net/note/reject/78498
Search -- https://master.php.net/manage/user-notes.php