Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 323 to 326

Definition

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

This article was last updated 15th December 2024 20:35 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.