Hey, I need to do some modifications to my UTF-8 characters.

I have name and last name stored in database in upper case: NAME SURNAME

Now I need it to be like Name Surname, even if it is UTF-8. If it wasnt UTF-8 I could easily use $name = ucfirst(strtolower($that_user['name']));

Now since it is UTF-8 I did some modifications, and now it is $name = ucfirst(mb_strtolower($that_user['name'], 'UTF-8'));

Thats ok for lowering cases, but how do I make first 2 letters upper case in case of UTF-8?

    Have a look at [man]mb_case_convert[/man], using MB_CASE_TITLE for the mode; there are quite a few scripts where the rule for capitalising a word isn't just a matter of using an upper-case form for the first letter.

      Write a Reply...