How to use mb_convert_case() function In PHP

The mb_convert_case() function in PHP is used for case folding, which means converting all characters of a string to uppercase or lowercase based on the specified mode.

Example:

PHP
<?php
$str = "geeks^for+geeks";
print ("Original String \n");
print ($str. "\n");

// Convert string to uppercase using mb_convert_case
$upperStr = mb_convert_case($str, MB_CASE_UPPER);
print ("Uppercase String \n");
print ($upperStr);
?>

Output
Original String 
geeks^for+geeks
Uppercase String 
GEEKS^FOR+GEEKS

How to convert lowercase string to uppercase using PHP ?

A string is a storage object in PHP comprising characters, numbers or special symbols. Strings in PHP are case-sensitive. The interconversion between lower and upper case can be easily done using various in-built methods in PHP.

Similar Reads

Using chr() method

This approach uses a variety of in-built PHP methods to convert a string to upper case characters. Initially, a string is declared consisting of characters, numbers or special symbols. The str_split() method is used to convert the string into an array of individual characters. The characters are mapped to specific indexes together to form a character array....

Using strtoupper() method

The strtoupper() is an inbuilt method in PHP which carries out case-conversion. The alphabetics are all converted to upper case, and returned to the form of a string. The numbers and special symbols remain unmodified. The result has to be saved in a variable in order to preserve the changes. This method is faster and optimized in comparison to the previous approach....

Using mb_convert_case() function

The mb_convert_case() function in PHP is used for case folding, which means converting all characters of a string to uppercase or lowercase based on the specified mode....