php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75108 mb_convert_case lacks ucfirst() mode
Submitted: 2017-08-23 10:12 UTC Modified: 2017-08-24 17:42 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chat dot noir at arcor dot de Assigned:
Status: Open Package: mbstring related
PHP Version: 7.0.22 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chat dot noir at arcor dot de
New email:
PHP Version: OS:

 

 [2017-08-23 10:12 UTC] chat dot noir at arcor dot de
Description:
------------
Three of four ASCII case conversion functions have equivalent modes of mb_convert_case():

1. strtoupper -> MB_CASE_UPPER
2. strtolower -> MB_CASE_LOWER
3. ucwords    -> MB_CASE_TITLE
4. ucfirst    -> ???

What's with the fourth? Would come in handy when you use some dynamic text at the beginning of a sentence.

Test script:
---------------
/* example by info at yasarnet dot com */
function capitalize($str, $encoding = 'UTF-8') {
    return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding);
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-24 17:42 UTC] kalle@php.net
If added, it might also make sense to implement lcfirst()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC