PHP – Make a lower case string using mb_strtolower()


In PHP, we can use the function mb_strtolower() to change a given string into lower case. It returns strings with all alphabetic characters converted to lowercase characters.

Syntax

string mb_strtolower(str $string, str $encoding)

Parameters

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

  • $string− The string being lowercased, returns strings with all alphabetic characters converted to lowercase characters.

  • $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 lowercase.

Example

 Live Demo

<?php
   // Upper and lower case characters are used to
   // convert in lower case using mb_strtoloower function
   $string = "Hello World!, Welcome to ONLINE tutorials";

   // It gives the output in lower case
   $string = mb_strtolower($string);
   echo $string;
?>

Output

It will conver all the characters in the given string to its lower case.

hello world! welcome to online tutorials

Updated on: 23-Aug-2021

466 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements