PHP中如何使用lcfirst函數(shù)

PHP
小樊
83
2024-08-10 13:25:38

在PHP中,lcfirst() 函數(shù)用于將字符串的第一個(gè)字符轉(zhuǎn)換為小寫(xiě)。以下是一個(gè)示例:

$str = "HelloWorld";
$lowerStr = lcfirst($str);

echo $lowerStr; // 輸出 "helloWorld"

在這個(gè)示例中,lcfirst() 函數(shù)將字符串 “HelloWorld” 的第一個(gè)字符 “H” 轉(zhuǎn)換為小寫(xiě) “h”,并返回新的字符串 “helloWorld”。

0