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
Syntax
mb_strtoupper(string $string, ?string $encoding = null): string
Parameters
| Parameter | Description |
|---|---|
string |
The input string. |
encoding optional |
The character encoding; defaults to mb_internal_encoding() (UTF-8). |
Return value
The uppercased string.
Examples
<?php
echo strtoupper("crème"), "\n";
echo mb_strtoupper("crème"), "\n";
Output
CRèME CRÈME
<?php
echo mb_strtoupper("straße"), "\n"; // ß becomes SS
echo mb_strtoupper("привет"), "\n";
Output
STRASSE ПРИВЕТ
Version history
| Version | Change |
|---|---|
| PHP 4.3 | Added |
In other languages
str.upper()· Pythonstring.toUpperCase()· JavaScript
Related
strtoupper()· Convert every ASCII letter in a string to uppercase. Letters such as é stay unchanged; use mb_strtoupper() for those.mb_strtolower()· Convert a string to lowercase, including letters outside ASCII such as É, Ü and Cyrillic. The Unicode-aware strtolower().mb_convert_case()· Change the case of a string with Unicode rules: upper, lower, title case or case folding for comparisons.- PHP Strings · tutorial