Shift-JISなどで置換をすると、文字化けすることがあるので
一度EUCに変換して、置換をし、SJISに戻す。
例)
$replaceArray = array("0","1","2","3","4","5","6","7","8","9","(");
//置換の文字化けをなくすため、EUCに変換
$stationAddress = mb_convert_encoding($stationAddress, 'EUC-JP', 'auto');
for($i=0;$i
$stationAddress = mb_ereg_replace($replaceStr."(.*?)(.+)","\\1",$stationAddress);
}
//SJISに戻す
$stationAddress = mb_convert_encoding($stationAddress, 'SJIS', 'auto');
1 / 2| 次のページ »
最近のコメント