LoginSignup
0
0

More than 5 years have passed since last update.

円記号を置換

Last updated at Posted at 2013-09-06

テキストエリアにフリーフォーマットで入力させた際に、半角の円記号(\)が邪魔になったので、どうにかする。

後続の処理で、改行コード変換のために、preg_replaceしてて、半角の円記号(\)が文字化けしていたので、苦肉の策(?)

$texta = "この値段は、\500ですが、なにか問題でも";

if(strstr($texta,"\\")){
    $texta = str_replace("\\","\\\\",$texta);
}

print $texta;
出力
表示結果:この値段は、\500ですが、なにか問題でも

これでいけるかな

0
0
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0