PHP 字符串 lcfirst() 函数

2024 年 9 月 4 日 | 阅读 1 分钟

lcfirst() 是 PHP 内置的字符串函数。它用于将字符串的第一个字符转换为小写。换句话说,它可以将字符串的第一个字符转换为小写。它返回转换后的字符串。

以下是相关函数。

  • ucfirst():用于将字符串的第一个字符转换为大写。
  • ucwords():用于将字符串的第一个单词的首字母转换为大写。
  • strtoupper():用于将字符串转换为大写。
  • strtolower():用于将字符串转换为小写。

语法

参数描述必需/可选
String指定要转换的字符串必需

示例 1

输出

Before using lcfirst() function:PHP
After using 'lcfirst()' function: pHP

示例 2

输出

Before using lcfirst() function: HELLO PHP
After using 'lcfirst()' function: hELLO PHP

下一主题PHP 字符串