ucfirst
将字符串的第一个字符设为大写
ucfirst()
函数把字符串中的首字符转换为大写。
lcfirst()
- 把字符串中的首字符转换为小写strtolower()
- 把字符串转换为小写strtoupper()
- 把字符串转换为大写ucwords()
- 把字符串中每个单词的首字符转换为大写把 "hello" 的首字符转换为大写:
<?php echo ucfirst("hello world!"); ?>
亲自试一试
ucfirst(string)
参数 | 描述 |
---|---|
string | 必需。规定要转换的字符串。 |