PHP 字符串 lcfirst()函數
lcfirst()是內置的PHP字符串函數。愛掏網 - it200.com它用于將字符串的第一個字符轉換為小寫。愛掏網 - it200.com換句話說,它可以將字符串的第一個字符轉換為小寫。愛掏網 - it200.com它返回轉換后的字符串。愛掏網 - it200.com
以下是相關的函數:
- ucfirst() :將字符串的第一個字符轉換為大寫。愛掏網 - it200.com
- ucwords() :將字符串的每個單詞的第一個字符轉換為大寫。愛掏網 - it200.com
- strtoupper() :將字符串轉換為大寫。愛掏網 - it200.com
- strtolower() :將字符串轉換為小寫。愛掏網 - it200.com
string lcfirst ( string $str );
參數 | 描述 | 必需/可選 |
---|---|---|
string | 指定要轉換的字符串 | 必需 |
示例1
<?php
echo "Before using lcfirst() function:PHP"."<br>";
arr = lcfirst("PHP");
echo "After using 'lcfirst()' function: ".arr;
?>
輸出:
Before using lcfirst() function:PHP
After using 'lcfirst()' function: pHP
示例2
<?php
echo "Before using lcfirst() function: HELLO PHP"."<br>";
arr = lcfirst("HELLO PHP");
echo "After using 'lcfirst()' function: ".arr;
?>
輸出:
Before using lcfirst() function: HELLO PHP
After using 'lcfirst()' function: hELLO PHP
聲明:所有內容來自互聯網搜索結果,不保證100%準確性,僅供參考。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。