PHP 8 reference · Multibyte String Functions

PHP mb_strtoupper() Function

Convert a string to uppercase, including letters outside ASCII such as é, ß and Cyrillic. The Unicode-aware strtoupper().

PHP 8 Since 4.3

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

Syntax

mb_strtoupper(string $string, ?string $encoding = null): string

Parameters

ParameterDescription
string The input string.
encoding optional The character encoding; defaults to mb_internal_encoding() (UTF-8).

Return value

The uppercased string.

Examples

Accented lettersTry it yourself
<?php
echo strtoupper("crème"), "\n";
echo mb_strtoupper("crème"), "\n";

Output

CRèME
CRÈME
Special casesTry it yourself
<?php
echo mb_strtoupper("straße"), "\n"; // ß becomes SS
echo mb_strtoupper("привет"), "\n";

Output

STRASSE
ПРИВЕТ

Version history

VersionChange
PHP 4.3Added

In other languages

Was this page helpful?