Using mb_strtolower() to Convert Strings to Lowercase in PHP

The article explains PHP's mb_strtolower() function, detailing its purpose to convert all alphabetic characters in a string to lowercase, describing its parameters, return value, and providing two illustrative examples—including handling of UTF‑8 encoded text.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
Using mb_strtolower() to Convert Strings to Lowercase in PHP

mb_strtolower() is a PHP function that returns the input string with all alphabetic characters converted to lowercase.

Parameters: str – the string to be converted; encoding – optional character encoding, defaulting to the internal encoding if omitted.

Return value: the string with all alphabetic characters in lowercase.

Example 1:

<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = mb_strtolower($str);
echo $str; // 输出:mary had a little lamb and she loved it so
?>

Example 2 (UTF‑8):

<?php
$str = "Τ?χιστη αλ?πηξ βαφ?? ψημ?νη γη, δρασκελ?ζει υπ?ρ νωθρο? κυν??";
$str = mb_strtolower($str, 'UTF-8');
echo $str; // 输出 τ?χιστη αλ?πηξ βαφ?? ψημ?νη γη, δρασκελ?ζει υπ?ρ νωθρο? κυν??
?>
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

encodingPHPStringexamplelowercasemb_strtolower
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.