php method to convert all strings to uppercase: 1. Create a PHP sample file; 2. Define the variables that need to be converted; 3. Convert the incoming character parameters through "strtoupper($str);" Convert all characters to uppercase and return the string in uppercase.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
How to convert all strings to uppercase in php?
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 parameters Convert to uppercase and return the string in uppercase. The usage is the same as strtolowe().
The code is as follows
$str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper($str); echo $str; // 打印 MARY HAD A LITTLE LAMB AND SHE LOVED IT SO ?>
Related introduction:
strtolower( ): This function converts all characters of the passed string parameter into lowercase and puts them back into the string in decimal form.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert all strings to uppercase in php. For more information, please follow other related articles on the PHP Chinese website!