Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: two minus two?
(Example: nine)

The Note You're Voting On

qeremy [atta] gmail [dotta] com
13 years ago
A proper Turkish solution;

<?php
function ucfirst_turkish($str) {
$tmp = preg_split("//u", $str, 2, PREG_SPLIT_NO_EMPTY);
return
mb_convert_case(
str_replace("i", "İ", $tmp[0]), MB_CASE_TITLE, "UTF-8").
$tmp[1];
}

function
ucwords_turkish($str) {
return
preg_replace("/(\\w+)/ue", "ucfirst_turkish('\\\\1').'$2'", $str);
}

$str = "iyilik güzelLİK şeker ";
echo
ucwords($str) ."\\n"; // Iyilik GüzelLİK şeker
echo ucwords_turkish($str); // İyilik GüzelLİK Şeker
?>

<< Back to user notes page

To Top