Home  >  Article  >  Backend Development  >  What is the function in php to convert letters to uppercase?

What is the function in php to convert letters to uppercase?

藏色散人
藏色散人Original
2021-11-09 10:22:032204browse

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.

What is the function in php to convert letters 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!

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