Skip to content

Instantly share code, notes, and snippets.

@WebFikirleri
Last active September 11, 2015 06:25
Show Gist options
  • Save WebFikirleri/1016570f2b5582df3cd1 to your computer and use it in GitHub Desktop.
Save WebFikirleri/1016570f2b5582df3cd1 to your computer and use it in GitHub Desktop.
Türkçe Ek Düzenleme
/*
Kullanımı:
$text = 'ADANA';
$ek = tr_ek_sec($text,'DE','DA');
echo "{$text}'{$ek}";
Çıktı:
ADANA'DA
*/
function tr_ek_sec($text, $de = 'de', $da='da') {
$last_word = end(explode(' ', $text));
$count_low = strripos($last_word, 'e') + strripos($last_word, 'i') + strripos($last_word, 'ö') + strripos($last_word, 'ü');
$count_high = strripos($last_word, 'a') + strripos($last_word, 'ı') + strripos($last_word, 'o') + strripos($last_word, 'u');
if ($count_low > $count_high) {
return $de;
} else {
return $da;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment