How to convert case to case in php
Most people do not understand the knowledge points of this article "php how to achieve case conversion", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "php how to achieve case conversion" article.
Case conversion method: 1, with strtolower (), the character can be converted to lowercase; 2, with strtoupper (), the character can be converted to uppercase; 3, with ucfirst (), the first letter of the string can be converted to uppercase; 4, with ucwords (), the first letter of each word in the string can be converted to uppercase.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The function of case conversion by php
1. Strtolower () function-converts characters to lowercase
The strtolower () function converts letters in a string to lowercase in the following syntax format:
Strtolower ($string)
Where $string is a parameter of type string, and this function converts the letters in the parameter $string to lowercase and returns the converted string.
2. Use the strtoupper function to convert characters to uppercase
The strtoupper () function converts letters in a string to uppercase, in the following syntax format:
Strtoupper ($string)
Where $string is a parameter of type string, and this function converts the letters in the parameter $string to uppercase and returns the converted string.
3. Use the ucfirst () function to convert the first letter to uppercase
The ucfirst function converts the first letter of a string to uppercase. The syntax format is as follows:
Ucfirst ($string)
Where $string is the string to be converted.
4. Use the ucwords () function to convert the first letter of each word to uppercase
The ucwords () function converts the first letter of each word in a string to uppercase, in the following syntax format:
Ucwords ($string [, $delimiters = "\ t\ r\ n\ f\ v"])
Where $string is the string to be converted, and $delimiters is an optional parameter to represent the word separator. The default is space character, tab character, line feed character, carriage return character, horizontal line, and vertical bar.
The above is about the content of this article on "how to convert php to lowercase". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.