实例
把所有字符转换为大写:
<?php
echo strtoupper("Hello WORLD!");
?>定义和用法
strtoupper() 函数把字符串转换为大写。
注释:该函数是二进制安全的。
相关函数:
strtolower() - 把字符串转换为小写
立即学习“PHP免费学习笔记(深入)”;
Perl学习手札是台湾perl高手写的一篇文章,特打包为chm版,方便大家阅读。 关于本书 1. 关于Perl 1.1 Perl的历史 1.2 Perl的概念 1.3 特色 1.4 使用Perl的环境 1.5 开始使用 Perl 1.6 你的第一个Perl程序 2. 标量变量(Scalar) 2.1 关于标量 2.1.1 数值 2.1.2 字符串 2.1.3 数字与字符串转换 2.2 使用你自己的变量 2.3 赋值 2.3.1 直接设定 2.3.2 还可以这样 2.4 运算 2.5 变量的输出/输入 2.
0
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()的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号