Simple function to change the case of your string and any accented html characters contained within it.
Inspired by fullUpper(), by silent at gmx dot li... just a little bit more atomic.
<?php
function convertCase($str, $case = 'upper')
{ switch($case)
{
case "upper" :
default:
$str = strtoupper($str);
$pattern = '/&([A-Z])(UML|ACUTE|CIRC|TILDE|RING|';
$pattern .= 'ELIG|GRAVE|SLASH|HORN|CEDIL|TH);/e';
$replace = "'&'.'\\1'.strtolower('\\2').';'"; break;
case "lower" :
$str = strtolower($str);
break;
}
$str = preg_replace($pattern, $replace, $str);
return $str;
}
?>
Depending on what you are trying to achieve you would call like this:
<?php
$str = convertCase(htmlentities($str, ENT_QUOTES, "ISO-8859-1"));
?>