Open In App

PHP mb_strtoupper() Function

Last Updated : 28 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The mb_strtoupper() function is an inbuilt function in PHP that helps to transform the multibyte string to uppercase.

Syntax:

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

Parameters:  This function has two parameters:

  • string:  This parameter specifies the string that is to be made to uppercase.
  • encoding: This parameter denotes the encoding parameter as the character encoding. In case if omitted or null,  then the internal character encoding value will be utilized.

Return value: This function converted all alphanumeric characters and then returns an uppercase string.

Example 1: The following code demonstrates the mb_strtoupper() function.

PHP




<?php
  
$str = "geeksforgeeks";
$str2 = mb_strtoupper($str);
  
echo $str2;
  
?>


Output:

GEEKSFORGEEKS

Example 2: The following code demonstrates the mb_strtoupper() function.

PHP




<?php
  
$str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός";
$str = mb_strtoupper($str, "UTF-8");
  
echo $str;
  
?>


Output:

ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ

Reference: https://www.php.net/manual/en/function.mb-strtoupper.php


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads