Home  >  Article  >  Backend Development  >  How to convert lowercase letters to uppercase letters in php

How to convert lowercase letters to uppercase letters in php

Guanhui
GuanhuiOriginal
2020-05-06 18:03:493697browse

How to convert lowercase letters to uppercase letters in php

How to convert lowercase letters to uppercase letters in php

How to convert lowercase letters to uppercase letters in php, you can use the "strtoupper" function To be done.

strtoupper() function and syntax

strtoupper - Convert the string to uppercase

strtoupper ( string $string ) : string

Convert all alphabetic characters in the string to uppercase and return.

Note that "letter" is related to the current area. For example, in the default "C" locale, the character umlaut-a (ä) is not converted.

strtoupper() example

<?php
$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
?>

The above is the detailed content of How to convert lowercase letters to uppercase letters in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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