Skip to content

Instantly share code, notes, and snippets.

@nasal
Created March 6, 2014 10:06
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasal/9386594 to your computer and use it in GitHub Desktop.
Save nasal/9386594 to your computer and use it in GitHub Desktop.
PHP: mb_ucwords
<?php
if (!function_exists('mb_ucwords'))
{
function mb_ucwords($str)
{
return mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
}
}
?>
@simonberger
Copy link

That doesn't produce the correct results.
Test this on "USA" or "DVD" before you decide if this still fits your needs.

@MathiasReker
Copy link

You can use this library to have the correct behavior: https://github.com/MathiasReker/php-mbstring-extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment