February 1, 2011

PHP:文字列を全て半角に

/##
 #  文字列を全て半角に
 #  @param  string $str 文字列
 #  @return string $str 半角の文字列
 # /
function toHankaku($str) {
    $str= mb_convert_kana($str,"rnask");
    return $str;
}
Share on Twitter Share the post
Qihuan Piao

Qihuan Piao

(aka kinopyo) is Chinese based in Tokyo. Software writer. He shares stories inspired him in this blog. His infamous line - "I feel calm when I kill those monsters, or people (in game)" shocks his friends deeply.

He also writes in Japanese and Chinese.