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.
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; // 输出 τ?χιστη αλ?πηξ βαφ?? ψημ?νη γη, δρασκελ?ζει υπ?ρ νωθρο? κυν??
?>Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
