php method to convert a string to lowercase: 1. strtolower() function, which can convert all letters in the string to lowercase, the syntax is "strtolower (string)"; 2. lcfirst() function , you can convert the first character in the string to lowercase, the syntax is "lcfirst(string)".
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php can change characters Convert string to lowercase
Method 1: Use strtolower() function
strtolower() function to convert string to lowercase.
Syntax:
strtolower(string)
Example:
<?php echo strtolower("Hello WORLD!"); ?>
Output:
hello world!
Method 2: Use lcfirst() function
lcfirst() function converts the first character in a string to lowercase.
Grammar:
lcfirst(string)
Example:
<?php echo lcfirst("HELLO WORLD!"); ?>
Output:
hELLO WORLD!
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert string to lowercase in php. For more information, please follow other related articles on the PHP Chinese website!