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

How to convert characters to uppercase letters in php?

青灯夜游
青灯夜游Original
2020-09-28 13:32:202339browse

How to convert php characters to uppercase letters: Use the built-in function strtoupper(); this function can convert a string to uppercase and then return a string converted to uppercase, the syntax is "strtoupper(string)".

How to convert characters to uppercase letters in php?

php Convert characters to uppercase letters

<?php 
echo strtoupper("h");
?>

Output:

H

Recommended : "PHP Video Tutorial"

Description:

strtoupper() function converts a string to uppercase.

Syntax

strtoupper(string)

Parameters:

string is a required parameter, used to specify the string to be converted.

Return value: Returns the string converted to uppercase.

Example:

<?php
echo strtoupper("hello world!");
?>

Output:

HELLO WORLD!

Related functions:

  • ##strtolower() - Convert a string to lowercase

  • lcfirst() - Convert the first character in the string to lowercase

  • ucfirst() - Convert the first character in the string to lowercase Convert characters to uppercase

  • ucwords() - Convert the first character of each word in the string to uppercase

Related recommendations:

phptraining

The above is the detailed content of How to convert characters 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