Home > Article > Backend Development > What is the function in php to convert letters to uppercase?
There are three functions in php to convert letters to uppercase, namely: 1. strtoupper function, used to convert strings to uppercase; 2. ucfirst function, used to convert the first character in a string to uppercase ;3. The ucwords function is used to convert the first character of each word in the string to uppercase.
The operating environment of this article: windows7 system, PHP version 7.1, DELL G3 computer
The function of php to convert letters to uppercase is What?
strtoupper() function converts a string to uppercase.
Note: This function is binary safe.
Related functions:
lcfirst() - Convert the first character in the string to lowercase
strtolower() - Convert the string to lowercase
ucfirst() - Converts the first character in the string to uppercase
ucwords() - Converts the first character of each word in the string to uppercase
Syntax
strtoupper(string)
Parameters
string required. Specifies the string to be converted.
Example
Convert all characters to uppercase:
<?php echo strtoupper("Hello WORLD!"); ?>
Running result:
HELLO WORLD.
Recommended learning: "PHP video tutorial 》
The above is the detailed content of What is the function in php to convert letters to uppercase?. For more information, please follow other related articles on the PHP Chinese website!