lcfirst(): first char to lower case

$str="Welcome to Plus2net.com";
echo  lcfirst($str);
Output is here
welcome to plus2net.com
Syntax
lcfirst( $input_string)
ParameterDESCRIPTION
$input_stringRequired : Input string
Output is the string with first char in lower case.

Let us try some examples

DEMO

Output :

Example: Convert Only First Character to Lowercase

$str = "Hello World";
echo lcfirst($str);  // Output: "hello World"

Example: Using lcfirst() with All Uppercase Strings

$str = "HELLO WORLD";
echo lcfirst($str);  // Output: "hELLO WORLD"

Example: Combining lcfirst() with ucfirst()

$str = "john doe";
echo ucfirst(lcfirst($str));  // Output: "John doe" (First letter of string capitalized, rest unchanged)

Example 2: Using lcfirst() with Special Characters

<?php
$str = "@Hello World!";
echo lcfirst($str);  // Output: "@Hello World!"
?>



String Functions ucfirst(): First char to upper case strtolower(): To all lower case strtoupper(): To all upper case Counting Sub string inside a string
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com











    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer