The strtoupper() is one of the most popular functions of PHP, which is widely used to convert the string into uppercase. It takes a string as a parameter and converts all lowercase English character of that string to uppercase. Other characters such as numbers and special characters of the string remain the same. PHP 4+ versions support this function.
Hint: Use the PHP strtoupper()
function
Syntax
strtoupper($string)
Parameters
$string (required): This is a mandatory parameter of this function which specifies a string to convert into uppercase. In simple words – it is a string which is converted into uppercase.
Return Value
It returns converted uppercase string.
Example
You can use the PHP strtoupper()
function to convert a string to uppercase. Let’s check out the following example to understand how this function actually works:
<?php
$my_str = 'Learn, Share and Grow Your Coding Skills';
echo strtoupper($my_str);
?>
Output
LEARN, SHARE AND GROW YOUR CODING SKILLS
There are some other functions in PHP which are similar to the strtoupper() function:
Related PHP functions
- strtolower() – It converts a string into lowercase.
- lcfirst() – It converts the first character of a string into lowercase.
- ucfirst() – It converts the first character of a string into uppercase.
- ucwords() – It converts the first character of each word in a string into uppercase.