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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions