Solved

php strip single '/'

Posted on 2014-12-22
2
82 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now