Encodera

Thanks for reading!

Donate to the site — we work hard for you.

PHP reference

mb_strtoupper

Converts a string to uppercase.

Available since: PHP 4

Syntax

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

Parameters

ParameterTypeDescription
$stringstringThe source string.
$encoding?stringThe 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:

ПРИВЕТ, WORLD

The reverse function is mb_strtolower():

<?php
 
echo mb_strtolower('ПРИВЕТ, World');

Output:

привет, world

Notes

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.

Thanks for reading!

Donate to the site — we work hard for you.