Encodera

Thanks for reading!

Donate to the site — we work hard for you.

PHP reference

lcfirst

Makes the first letter of a string lowercase.

Syntax

lcfirst(string $string): string

Parameters

ParameterTypeDescription
$stringstringThe input string.

Return value

stringThe string with a lowercase first letter.

Examples

From PascalCase to camelCase:

<?php
 
echo lcfirst('UserName');

Output:

userName

Notes

Works with ASCII letters only. The other letters of the string are unchanged.

See also

  • ucfirst — Makes the first letter of a string uppercase.
  • ucwords — Uppercases the first letter of every word.
  • strtolower — Converts ASCII letters to lowercase.

Related recipes

In the tutorial

  • Strings — Working with strings in PHP — quotes, concatenation, length, searching, replacing and multibyte functions.

Thanks for reading!

Donate to the site — we work hard for you.