实例
把所有字符转换为大写:
<?php
echo strtoupper("hello world!");
?>
定义和用法
strtoupper() 函数把字符串转换为大写。
注释:该函数是二进制安全的。
相关函数:
strtolower() - 把字符串转换为小写
lcfirst() - 把字符串中的首字符转换为小写
ucfirst() - 把字符串中的首字符转换为大写
ucwords() - 把字符串中每个单词的首字符转换为大写
语法
strtoupper(string)
参数 描述
string 必需。规定要转换的字符串。
技术细节
返回值: 返回转换为大写的字符串。
php 版本: 4+
strtoupper() 函数 把字符串转换为大写
public function set_kw($kw){
$_intasc=ord(substr($kw,0,1));
if(($_intasc>64 and $_intasc<91)or($_intasc>96 and $_intasc<123)){
$this->set_query_q('pinyin:'.strtoupper($kw).'*');
}else{
$this->set_dismax_model();
$this->set_query_q($kw);
$this->set_query_qf("name^10 address^5");
}
}
以上就是php把字符串转换为大写的函数strtoupper()的详细内容。
