PHP lcfirst() Function
In this chapter you will learn:
- Definition for PHP lcfirst() Function
- Syntax for PHP lcfirst() Function
- Parameter for PHP lcfirst() Function
- Return for PHP lcfirst() Function
- Related functions for lcfirst() Function
- Example - Convert the first character of "Hello" to lowercase
Definition
The lcfirst() function converts the first character of a string to lowercase.
Syntax
PHP lcfirst() Function has the following syntax.
lcfirst(string)
Parameter
Parameter | Is Required | Description |
---|---|---|
string | Required. | String to convert |
Return
PHP lcfirst() Function returns the converted string.
Related functions
- 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
Example
Convert the first character of "Hello" to lowercase:
<?php
echo lcfirst("Hello world from java2s.com!");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP levenshtein() Function
- Syntax for PHP levenshtein() Function
- Parameter for PHP levenshtein() Function
- Return for PHP levenshtein() Function
- Example - Calculate the Levenshtein distance between two strings
Home » PHP Tutorial » PHP String Functions