在PHP中,可以使用内置函数strtoupper()
将一个字符串中的所有字符转换为大写形式。
例如,将字符串"hello world"
转换为大写形式:
$str = "hello world";
$str = strtoupper($str);
echo $str; // 输出 "HELLO WORLD"
另外,如果只想将字符串的首字母转换为大写形式,可以使用内置函数ucfirst()
。
例如,将字符串"hello world"
的首字母转换为大写形式:
$str = "hello world";
$str = ucfirst($str);
echo $str; // 输出 "Hello world"
希望对你有所帮助!
下一篇:php怎么选中图片删除
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站