note 129865 added to function.mb-ucfirst
| From: | hans@loltek.net | Date: | Thu, 21 Nov 2024 21:53:38 +0000 |
| Subject: | note 129865 added to function.mb-ucfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221664@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 84.49.158.188)
----
Manual Page -- https://php.net/manual/en/function.mb-ucfirst.php
Edit -- https://main.php.net/note/edit/129865
Del: integrated -- https://main.php.net/note/delete/129865/integrated
Del: useless -- https://main.php.net/note/delete/129865/useless
Del: bad code -- https://main.php.net/note/delete/129865/bad+code
Del: spam -- https://main.php.net/note/delete/129865/spam
Del: non-english -- https://main.php.net/note/delete/129865/non-english
Del: in docs -- https://main.php.net/note/delete/129865/in+docs
Del: other reasons-- https://main.php.net/note/delete/129865
Reject -- https://main.php.net/note/reject/129865
Search -- https://main.php.net/manage/user-notes.php