Solved

php strip single '/'

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
spacing 5 31
compressing images after upload 4 31
PHP string issue 5 18
Showing data from 2 sql queries in one dropdown 8 14
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
The viewer will learn how to count occurrences of each item in an array.
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.

747 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

18 Experts available now in Live!

Get 1:1 Help Now