Search code examples
phpcapitalize

need capitalize words with special chars in PHP


ucwords doesn't capitalize foreign chars like öüäõ

so I need a solution, which will make "öösel" into "Öösel"

Is there a simple way to do it with regexp or I have to check all the characters manually?


Solution

  • If you have the mbstring extension installed, you can use the mb_convert_case function, specifying MB_CASE_TITLE as the $mode parameter.