Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

lcfirst()

Lowercase the first byte if it is an ASCII uppercase letter and leave the rest unchanged.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

lcfirst(string $string): string

Lowercase the first byte if it is an ASCII uppercase letter and leave the rest unchanged. Since PHP 8.2 the operation is locale-independent. An initial punctuation mark or a multibyte uppercase character prevents any change to later letters.

Signature

lcfirst(string $string): string

Example output

["xMLTag","-Name","École",""]

Examples

<?php
echo json_encode([lcfirst("XMLTag"),lcfirst("-Name"),lcfirst("\u{00C9}cole"),lcfirst("")],JSON_UNESCAPED_UNICODE);

Result

["xMLTag","-Name","École",""]

Sources