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
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.