PHP 中的 lcfirst() 函数

phpprogrammingserver side programming更新于 2025/8/6 23:07:17

lcfirst 函数用于将字符串的首字符转换为小写。它返回转换后的字符串。

语法

lcfirst(str)

参数

  • str − 待转换的字符串。

返回

lcfirst() 函数返回转换后的字符串。

示例

下面是一个例子 −

<?php
   echo lcfirst("Welcome to the website");
?>

输出

以下是输出 −

welcome to the website

示例

让我们看另一个例子 −

<?php
   $res = 'WEB WORLD!';
   $res = lcfirst($res);
   echo $res;
   $res = lcfirst(strtoupper($res));
   echo $res;
?>

输出

以下是输出 −

wEB WORLD!wEB WORLD!

相关文章