Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 92
  • Last Modified:

php strip single '/'

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
movieprodw
Asked:
movieprodw
1 Solution
 
GaryCommented:
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
 
movieprodwAuthor Commented:
Ha, easy enough
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now