Solved

php strip single '/'

Posted on 2014-12-22
2
87 Views
Last Modified: 2014-12-22
Hello,

I have a csv file and it is fed every night.

I then import it into my table.

The issue is that there is a single '\' in the feed and I can not get the darn person to remove it.

How do I remove it?
...Please call for more information. \ ","Turbocharged",...

Open in new window


I tried this, but it did not remove it:
$file = '/var/www/vhosts/domain.com/web_users/ebiz/dealerdotcom.txt';
$current = file_get_contents($file);
$current = str_replace('. \'','',$current);
file_put_contents($file, $current);

Open in new window

0
Comment
Question by:movieprodw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40514161
The backslash is an escape character so you have to escape the escape

$current = str_replace('. \\','',$current);

Open in new window


You were escaping the apostrophe
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 40514187
Ha, easy enough
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question