The mb_strtoupper Function

The mb_strtoupper function converts a string to uppercase, correctly working with multibyte encodings (for example, UTF-8). The first parameter is the string to convert, the second (optional) - is the string encoding.

Syntax

phpmb_strtoupper(string, [encoding]);

Example

Convert a string to uppercase:

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

Code execution result:

php'ПРИВЕТ'

Example

Convert a string to uppercase:

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

Code execution result:

php'ABCDE'

Example

Convert a string with explicit encoding specification:

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

Code execution result:

php'ÄÖÜ'

See Also

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