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)
Parameter | DESCRIPTION |
$input_string | Required : Input string |
Output is the string with first char in lower case.
Let us try some examples
DEMO
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
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com