PHP Tutorial - PHP lcfirst() Function






Definition

The lcfirst() function converts the first character of a string to lowercase.

Syntax

PHP lcfirst() Function has the following syntax.

lcfirst(string)

Parameter

ParameterIs RequiredDescription
stringRequired.String to convert

Return

PHP lcfirst() Function returns the converted string.

  • 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.