1
我有一個PHP函數,當$word_two
以元音開頭時,它刪除最後一個字母$word_one
,並將這個單詞放進一個apostroph。但是用法語元音é它不起作用,儘管我使用mb_strtolower
和, 'UTF-8'
。mb_strtolower不能與法語元音一起使用é
我不想更改$pers
數組,因爲我也有組合的單詞,其中$word_two
不以元音開頭。
function French($word_one, $word_two) {
if (in_array(mb_strtolower($word_two{0}, 'UTF-8'), array('a', 'e', 'é', 'i', 'o')) and ($word_one == "je" or $word_one == "que je"))
// delete last letter in $word_one and add an apostrophe and all of $word_two é don't work
$output = substr($word_one, 0, -1) . '\'' . $word_two;
else
// other wise combine the words with a space in between
$output = $word_one . ' ' . $word_two;
return $output;
}
例如:以Unicode模式(u
)
$pers = array('je', "tu", "il/elle/on", "nous", "vous", "ils/elles");
$que_pers = array("que je", "que tu", "qu'il/elle/on", "que nous", "que vous", "qu'ils/elles");
$Ind['I'] = array ('étais','étais','était','étions','étiez','étaient');
$Sub['Pré'] = array ('aie','aies','ait','ayons','ayez','aient');
echo ''.French($pers[0], $Ind['I'][0]).'';
echo ''.French($que_pers[0], $Sub['Pré'][0]).'';
UTF-8也是源代碼嗎? – 2014-08-31 17:30:04
@dolan我想是這樣,例如'$ Ind ['I'] = array('étais','étais','était','étions','étiez','étaient');' – Grischa 2014-08-31 17:35:06
你能給我一個例子的用法? – 2014-08-31 17:40:34