Home > Article > Backend Development > How to convert to lowercase in php?
How to convert to lowercase in php?
1. Convert the string to lowercase
strtolower(): This function will convert all the characters in the string parameter passed in Converts both to lowercase and returns the string in lowercase.
Example:
<?php $str = "I want To FLY"; $str = strtolower($str); echo $str; ?>
Output result:
i want to fly
2. Convert characters to uppercase
strtoupper(): The function of this function is the opposite of the strtolower function. It converts all the characters of the incoming character parameter into uppercase and returns the string in uppercase; Usage Same as strtolowe().
3. Convert the first character of the string to uppercase
usfilst(): The function of this function is to convert the first character of the string to uppercase If the character is changed to uppercase, this function returns a string with the first character in uppercase; the usage is the same as strtolowe().
4. Convert the first character of each word in the string to uppercase
ucwords(): This function converts the incoming string The first character of each word becomes uppercase; such as "hello world", after being processed by this function, "Hello Word" will be returned; the usage is the same as strtolowe().
Recommended tutorial: "php tutorial"
The above is the detailed content of How to convert to lowercase in php?. For more information, please follow other related articles on the PHP Chinese website!