"ucfirst() function for multibyte character encodings" Code Answer

5

There is no mb_ucfirst function, as you've already noticed. You can fake a mb_ucfirst with two mb_substr:

function mb_ucfirst($string, $encoding)
{
    $firstChar = mb_substr($string, 0, 1, $encoding);
    $then = mb_substr($string, 1, null, $encoding);
    return mb_strtoupper($firstChar, $encoding) . $then;
}
By yaredyilma11-f1a3f46f2f51 on October 1 2022

Answers related to “ucfirst() function for multibyte character encodings”

Only authorized users can answer the search term. Please sign in first, or register a free account.