PHP – Make an upper case string using mb_strtoupper()


In PHP, mb_strtoupper() is an inbuilt function that is used to change a given string to upper case.

Syntax

string mb_strtoupper(str $string, str $encoding)

Parameters

mb_strtoupper() accepts two parameters: $string and $encoding.

  • $string− The string being uppercased.

  • $encoding− This parameter is the character encoding. If it is absent or null, then the internal character encoding value will be used.

Return Values

string with all alphabetic characters converted to uppercase.

Example

 Live Demo

<?php
   $string = "Hello World!, Welcome to online tutorials";
   $string = mb_strtoupper($string);
   echo $string;
?>

Output

It will convert the given string to upper case.

HELLO WORLD!, WELCOME TO ONLINE TUTORIALS

Updated on: 23-Aug-2021

220 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements