Jump to content

[SOLVED] Reading data from a file with " in it


VTS

Recommended Posts

I have a quick question about this.  My data in a file looks like this:

 

"2 4 .98 .09"

"4 4 .50 .40"

 

The format is store#, dept it, goal, actual.

What I need to do is read this data from a text file into my database but I do not know how to remove the " marks from the file.  How do I go about doing this?  Can I use add or strip slashes somehow?

 

thanks in advance,

VTS

addslashes adds slashes in front of quotes it doesn't remove quotes. strip slashes reverses what addslashes does and that remove the slashes added to the quotes.

 

What you will want to do is use str_replace instead. To remove the quotes.

 

 $str = '"2 4 .98 .09"';

$str = str_replace('"', '', $str);

echo $str;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.