PHP strtoupper() Function

Last updated on February 24, 2023

In PHP, the strtoupper() function converts all the characters into uppercase. In PHP, the strtoupper() function converts all the characters into uppercase. It accepts one parameter and returns the value in the string.

For example, if you pass “learn programming” into the strtoupper() function as an argument then it would return “LEARN PROGRAMMING”.

Syntax

strtoupper(string)

Parameters

It has one required parameter that refers to the value which needs to be converted into uppercase.

PHP Supported Version

  • PHP 4
  • PHP 5
  • PHP 7
  • PHP 8

Usage
You can directly pass the value into the function that needs to be converted.

echo strtoupper("learn programming");
// Output: LEARN PROGRAMMING

Also, it works with variables. So you need to create a variable and store a string.

// save string to variable
$string = "learn programming";

echo strtoupper($string);
// Output: LEARN PROGRAMMING

In this example, we stored a string containing lower characters into a variable and passed it into the strtoupper() function for converting it into uppercase.


Written by
I am a skilled full-stack developer with extensive experience in creating and deploying large and small-scale applications. My expertise spans front-end and back-end technologies, along with database management and server-side programming.

Share on:

Related Posts

Tags: PHP, PHP-Functions,