PHP 带有特殊字符的大写字母
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 带有特殊字符的大写字母相关的知识,希望对你有一定的参考价值。
<?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: äöüß");
?>
以上是关于PHP 带有特殊字符的大写字母的主要内容,如果未能解决你的问题,请参考以下文章