mb_strtoupper
Converts a string to uppercase.
Available since: PHP 4
Syntax
mb_strtoupper(string $string, ?string $encoding = null): stringParameters
| Parameter | Type | Description |
|---|---|---|
| $string | string | The source string. |
| $encoding | ?string | The encoding. Defaults to the internal one, usually UTF-8. |
Return value
stringThe string with every letter uppercased.
Examples
Works with letters of any alphabet:
<?php
echo mb_strtoupper('привет, world');Output:
ПРИВЕТ, WORLDThe reverse function is mb_strtolower():
<?php
echo mb_strtolower('ПРИВЕТ, World');Output:
привет, worldNotes
Plain strtoupper() changes only ASCII letters and leaves Cyrillic untouched.
See also
- ucfirst — Makes the first letter of a string uppercase.
Related recipes
In the tutorial
- Strings — Working with strings in PHP — quotes, concatenation, length, searching, replacing and multibyte functions.