I am trying to replace the last character in a Japanese word with another. substr_replace did not work - I figured because it was multibyte so I tried using only multibyte functions, but it is still not working. Here's the code I'm trying
<meta charset="utf-8">
<?php
$word='くたくた';
//substr_replace($word, 'ひ',-1);
$length=mb_strlen ( $word);
$length--;
$word = mb_substr ( $word , $start ,$length).'ひ';
echo $word;
?>
Which results in くたく��ひ
I am probably just using the multi_byte functions wrong but can't see how.