TUTORIAL后端与 Web 服务FETCHED

PHP ucfirst() 函数

PHP ucfirst() 函数 PHP String 参考手册 实例 把 'hello' 的首字符转换为大写: <?phpecho ucfirst('hello world!');?> 运行实例 » 定义和用法 ucfirst() 函数把字符串中的首字符转换为大写。 相关函数: lcfirst() - 把字符串中的首字符转换为小写 ucwo..

更新于 2026/7/16

教程详情页默认 noindex。

PHP ucfirst() 函数

PHP String 参考手册 PHP String 参考手册

实例

把 "hello" 的首字符转换为大写:

<?php
echo ucfirst("hello world!");
?>

运行实例 »

定义和用法

ucfirst() 函数把字符串中的首字符转换为大写。

相关函数:


语法

ucfirst(string)

参数 描述
string 必需。规定要转换的字符串。

技术细节

返回值: 返回已转换的字符串。
PHP 版本: 4+


PHP String 参考手册 PHP String 参考手册