Extra backslash needed in PHP regexp pattern

后端 未结 4 1024
醉梦人生
醉梦人生 2020-11-28 13:22

When testing an answer for another user\'s question I found something I don\'t understand. The problem was to replace all literal \\t \\n \\r

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 13:52

    Use str_replace!

    $code = str_replace(array("\t","\n","\r"),'',$code);
    

    Should do the trick

提交回复
热议问题