Collections functions
General functions
Render functions
Theme permission functions
Resource functions

ucfirstletter()

Description

Returns a string with the first LETTER of $string capitalized.
Compare with ucfirst($string) which returns a string with first CHAR of $string capitalized:
ucfirstletter("abc") / ucfirstletter("%abc") returns "Abc" / "%Abc"
ucfirst("abc") / ucfirst("%abc") returns "Abc" / "%abc"

Search for the first letter ([a-zA-Z]), which may or may not be followed by other characters (.).
Replaces the found substring ('$0') with the same substring but now with the first character capitalized, using ucfirst().
Note the /e modifier: If this modifier is set, preg_replace() does normal substitution of backreferences in the replacement
string, evaluates it as PHP code, and uses the result for replacing the search string.

Parameters

ColumnTypeDefaultDescription
$string mixed

Return

string|array|null

Location

include/language_functions.php lines 306 to 309

Definition

 
function ucfirstletter($string)
    {
    return 
preg_replace_callback("/[a-zA-Z].*/""ucfirstletter_callback"$string);
    }

This article was last updated 30th September 2022 17:05 Europe/London time based on the source file dated 5th July 2022 14:55 Europe/London time.