strtoupper()

strtoupper() — Make a string uppercase.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Returns string with all ASCII alphabetic characters converted to uppercase.

Signature

strtoupper(string $string): string

Parameters

ParameterTypeWhat it takes
$stringstringThe input string.

Return value

Returns the uppercased string.

Example

A runnable snippet:

$str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper($str); echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO

Changelog

VersionChange
8.2.0Case conversion no longer depends on the locale set with setlocale(). Only ASCII characters will be converted.

See also

strtolower(), ucfirst(), ucwords(), mb_strtoupper()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page strtoupper() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.