CKTIS / PHP
ucfirst()
Uppercase the first byte if it is an ASCII lowercase letter.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
ucfirst(string $string): stringUppercase the first byte if it is an ASCII lowercase letter. Later letters and leading punctuation are unchanged. Since PHP 8.2 locale does not affect the result and the first byte of a non-ASCII UTF-8 letter is not uppercased.
Signature
ucfirst(string $string): string
Example output
["ABC",".word","élan"]
Examples
<?php
echo json_encode([ucfirst("aBC"),ucfirst(".word"),ucfirst("\u{00E9}lan")],JSON_UNESCAPED_UNICODE);
Result
["ABC",".word","élan"]