How php converts words to uppercase letters
This article will explain in detail how php converts words to uppercase letters. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Conversion method: 1, using the strtoupper () function, you can convert all the letters of the words in the string to uppercase, the syntax "strtoupper (string)"; 2, using the ucwords () function, you can convert the first letter of each word in the string to uppercase, the syntax "ucwords (string)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php converts words in a string to uppercase letters
1. Use the strtoupper () function
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.
Example:
2. Use the ucwords () function
The ucwords () function converts the first character of each word in the string to uppercase, in the following syntax format:
Ucwords ($string)
Where $string is a parameter of type string, and this function converts the first character of each word in the parameter $string to uppercase and returns the converted string.
Example:
This is the end of the article on "how php converts words into capital letters". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.