实例
把 hello 的首字符转换为小写。:
<?php
echo lcfirst("hello world!");
?>
定义和用法
lcfirst() 函数把字符串中的首字符转换为小写。
相关函数:
ucfirst() - 把字符串中的首字符转换为大写。
ucwords() - 把字符串中每个单词的首字符转换为大写。
strtoupper() - 把字符串转换为大写。
strtolower() - 把字符串转换为小写。
语法
lcfirst(string)
参数 描述
string 必需。规定要转换的字符串。
技术细节
返回值: 返回已转换的字符串。
php 版本: 5.3.0+
例子:
<?php
$foo = 'helloworld';
$foo = lcfirst($foo); // helloworld
$bar = 'hello world!';
$bar = lcfirst($bar); // hello world!
$bar = lcfirst(strtoupper($bar)); // hello world!
?>
以上就是php把字符串中的首字符转换为小写函数lcfirst()的详细内容。