php怎么将字符串转为小写

来自:互联网
时间:2021-05-17
阅读:

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!
返回顶部
顶部