Last active
September 11, 2015 06:25
-
-
Save WebFikirleri/1016570f2b5582df3cd1 to your computer and use it in GitHub Desktop.
Türkçe Ek Düzenleme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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