Tác dụng của hàm lcfirst()
The lcfirst()
function converts the first character of a string to lowercase.
The following table summarizes the technical details of this function.
Return Value: | Returns the modified string. |
---|---|
Version: | PHP 5.3.0+ |
Syntax
The basic syntax of the lcfirst()
function is given with:
lcfirst(string);
The following example shows the lcfirst()
function in action.
Ví dụ
<?php
// Sample string
$str = "Hello World!";
// Making string's first character lowercase
echo lcfirst($str);
?>
Here's a list of the functions related to lcfirst()
function:
ucfirst()
– Converts the first character of a string to uppercase.ucwords()
– Converts the first character of each word in a string to uppercase.strtoupper()
– Converts a string to uppercase.strtolower()
– Converts a string to lowercase.
Parameters
The lcfirst()
function accepts the following parameters.
Parameter | Description |
---|---|
string | Required. Specifies the string to work on. |