Home > Backend Development > PHP Tutorial > PHP - Convert string to lowercase using mb_strtolower() function

PHP - Convert string to lowercase using mb_strtolower() function

WBOY
Release: 2023-09-14 15:10:01
forward
949 people have browsed it

PHP - 使用mb_strtolower()函数将字符串转换为小写字母

In PHP we can change a given string to lowercase using the function mb_strtolower(). It returns a string with all alphabetic characters converted to lowercase characters.

Syntax

string mb_strtolower(str $string, str $encoding)
Copy after login

Parameters

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

< ul class="list">
  • $string− Lowercase string, returns a string with all alphabetic characters converted to lowercase characters.

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

  • Return value

    StringAll alphabetic characters are converted to lowercase.

    Example

    Live Demonstration

    <?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;
    ?>
    Copy after login

    Output

    It converts all characters in the given string to lowercase.

    hello world! welcome to online tutorials
    Copy after login

    The above is the detailed content of PHP - Convert string to lowercase using mb_strtolower() function. For more information, please follow other related articles on the PHP Chinese website!

    source:tutorialspoint.com
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template