PHP 8 reference · String Functions

PHP strtoupper() Function

Convert every ASCII letter in a string to uppercase. Letters such as é stay unchanged; use mb_strtoupper() for those.

PHP 8 Since 4.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

strtoupper(string $string): string

Parameters

ParameterDescription
string The input string.

Return value

The uppercased string.

Examples

Uppercase textTry it yourself
<?php
echo strtoupper("camel case"), "\n";
echo strtoupper("order #a12-b"), "\n"; // digits and symbols stay

Output

CAMEL CASE
ORDER #A12-B
Accented letters need mb_strtoupper()Try it yourself
<?php
echo strtoupper("café"), "\n";
echo mb_strtoupper("café"), "\n";

Output

CAFé
CAFÉ

Version history

VersionChange
PHP 4.0Added
PHP 8.2Case conversion no longer depends on the locale: only ASCII letters a–z change.

In other languages

Was this page helpful?