How to convert all strings to uppercase in php

藏色散人
Release: 2023-03-14 15:20:01
Original
3080 people have browsed it

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.

How to convert all strings to uppercase in php

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
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!