I am trying to convert standard ASCII letters to their full-width Japanese equivalents. For example:
Game
becomes Game
I searched for an answer and I found this question with a good answer that I've quoted below:
$str = "Game some other text by ヴィックサ";
$str = preg_replace_callback(
"/[\x{ff01}-\x{ff5e}]/u",
function($c) {
// convert UTF-8 sequence to ordinal value
$code = ((ord($c[0][0])&0xf)<<12)|((ord($c[0][1])&0x3f)<<6)|(ord($c[0][2])&0x3f);
return chr($code-0xffe0);
},
$str);
But I wanted it in the opposite direction. I tried changing the (-) sign to (+) in the return statementm, but didnt have much success.