strtoupper()
Make a string uppercase
Learn how to force a string value to uppercase.
strtoupper()
function takes one string as an input and converts all lowercase characters
of the string to uppercase.
This function only affects the alphabets and other characters remain same.
strtoupper()
prototype
This means thatstring strtoupper ( string $str )
strtoupper()
accepts string and returns the uppercased string (uppercased the all lowercase characters).
We could rewrite the above function definition in an easy to understandable way:
Function Part | Description |
---|---|
string | Type of value this function returns, which is a string, in this case returns the lowercased string. |
strtoupper | The function name |
string | Parameter type, this function accepts only string data type |
$str | Parameter name, a variable that holds the data |
Syntax
strtoupper($str)
Return Value
strtoupper()
function returns string
, with uppercased all the alphabetic characters.
Examples
Example 1
<?php $str = 'I am PHP string'; //upercase entire string $Uppercase = strtoupper($str); echo $Uppercase; ?>
The above code prints I AM PHP STRING
on browser screen.