php將字符串轉為小寫的方法:1、strtolower()函數,可以將字符串中的字母全部轉換為小寫,語法“strtolower(字符串)”;2、lcfirst()函數,可以將字符串中的首字符轉換為小寫,語法“lcfirst(字符串)”。

本教程操作環境:windows7系統、PHP7.1版,DELL G3電腦
php可以將字符串轉為小寫
方法1:使用strtolower() 函數
strtolower() 函數把字符串轉換為小寫。
語法:
strtolower(string)
示例:
<?php echo strtolower("Hello WORLD!"); ?>
輸出:
hello world!
方法2:使用lcfirst()函數
lcfirst() 函數把字符串中的首字符轉換為小寫。
語法:
lcfirst(string)
示例:
<?php echo lcfirst("HELLO WORLD!"); ?>
輸出:
hELLO WORLD!
推薦學習:《PHP視頻教程》
站長資訊網