64 of 410 menu

The mb_strtoupper Function

The mb_strtoupper function converts a string to uppercase, correctly handling multibyte encodings (e.g., UTF-8). The first parameter is the string to convert, the second (optional) - is the string encoding.

Syntax

mb_strtoupper(string, [encoding]);

Example

Convert a string to uppercase:

<?php echo mb_strtoupper('привет'); ?>

Code execution result:

'ПРИВЕТ'

Example

Convert a string to uppercase:

<?php echo mb_strtoupper('abcde'); ?>

Code execution result:

'ABCDE'

Example

Convert a string with explicit encoding specification:

<?php echo mb_strtoupper('äöü', 'UTF-8'); ?>

Code execution result:

'ÄÖÜ'

See Also

  • the mb_strtolower function,
    which converts a string to lowercase
  • the strtoupper function,
    which converts a string to uppercase
byenru