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

string strtoupper ( string $str )
This means that 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:
Explanation of strtoupper() function definition
Function PartDescription
stringType of value this function returns, which is a string, in this case returns the lowercased string.
strtoupperThe function name
stringParameter type, this function accepts only string data type
$strParameter 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.

Contents and Related Tutorials

  1. Make string first's character uppercase
  2. Make string first's character lowercase
  3. Make a string lowercase
  4. Make a string uppercase
  5. Uppercase first character of each word in a string