polyfill:
<?php
if(PHP_VERSION_ID < 80400) {
function mb_ucfirst(string $str, string $encoding = null): string
{
if ($encoding === null) {
$encoding = mb_internal_encoding();
}
return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, null, $encoding);
}
}
?>
if you wonder why i bother with mb_internal_encoding: prior to php7, $encoding was not nullable. if your polyfill don't need php5.6 support, you can drop it.