php-src icon indicating copy to clipboard operation
php-src copied to clipboard

mb_convert_case does not convert upper case letters

Open tbelknapsgs opened this issue 4 years ago • 4 comments

Description

The following code:

<?php
echo mb_convert_case('THIS IS ALL CAPS', MB_CASE_TITLE);

Resulted in this output:

THIS IS ALL CAPS

But I expected this output instead:

This Is All Caps

This does follow the behavior of the non-mb function ucwords(), however does the name of the constant not imply that this should convert upper case letters to lower?

PHP Version

7.4

Operating System

Ubuntu 20

tbelknapsgs avatar Feb 21 '22 18:02 tbelknapsgs

Title-case means first letter of a word is upper-case, following letters are lower-case. As such, the function with MB_CASE_TITLE does what it should. Are you looking for MB_CASE_LOWER (or mb_strtolower())?

cmb69 avatar Feb 21 '22 18:02 cmb69

Title-case means first letter of a word is upper-case, following letters are lower-case. As such, the function with MB_CASE_TITLE does what it should. Are you looking for MB_CASE_LOWER (or mb_strtolower())?

I just reread my original ticket and updated it. I had it backwards, expected vs actual output. Sorry about that!

tbelknapsgs avatar Feb 21 '22 18:02 tbelknapsgs

Yeah, but see https://3v4l.org/KW2cu. What am I missing?

cmb69 avatar Feb 21 '22 18:02 cmb69

You're not. I think I may be the victim of a repository update. Please disregard.

tbelknapsgs avatar Feb 21 '22 19:02 tbelknapsgs