Solved

php strip single '/'

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

Technology Partners: 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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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