Skip to content

Instantly share code, notes, and snippets.

@amirkhiz
Last active June 30, 2017 10:41
Show Gist options
  • Save amirkhiz/32129e9efabb54a5d27dc518d585d13b to your computer and use it in GitHub Desktop.
Save amirkhiz/32129e9efabb54a5d27dc518d585d13b to your computer and use it in GitHub Desktop.
Turkish Capitalize (Title case) for string
function titleCaseTurkish($string)
{
$temp = preg_split("/\s/u", $string, -1, PREG_SPLIT_NO_EMPTY);
foreach ($temp as &$item) {
$item = str_replace("i", "İ", $item);
}
$temp = join(' ', $temp);
return mb_convert_case($temp, MB_CASE_TITLE, "UTF-8");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment