← 返回列表

PHP ucfirst() 函数

PHP ucfirst() 函数 实例 把 "hello" 的首字符转换为大写: <?php echo ucfirst("hello world!"); ?> 定义和用法 ucfirst() 函数把字符串中的首字符转换为大写。 相关函数: lcfirst() - 把字符串中的首字符转换为小写 ucwords() - 把字符串中每个单词的首字符转换为大写 strtoupper() - 把字符串转换为大写 strtolower() - 把字符串转换为小写 语法 ucfirst( _string_ ) 参数 描述 _string_ 必需。规定要转换的字符串。 技术细节 返回值: 返回已转换的字符串。 PHP 版本: 4+

PHP ucfirst() 函数


实例

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

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

定义和用法

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

相关函数:

语法

ucfirst( _string_ )
参数 描述
_string_ 必需。规定要转换的字符串。

技术细节

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

打开资源 ↗

交流与评论