VTS Posted April 9, 2007 Share Posted April 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/46313-solved-reading-data-from-a-file-with-in-it/ Share on other sites More sharing options...
wildteen88 Posted April 9, 2007 Share Posted April 9, 2007 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; Quote Link to comment https://forums.phpfreaks.com/topic/46313-solved-reading-data-from-a-file-with-in-it/#findComment-225321 Share on other sites More sharing options...
VTS Posted April 9, 2007 Author Share Posted April 9, 2007 Thanks a bunch for the quick reply. Quote Link to comment https://forums.phpfreaks.com/topic/46313-solved-reading-data-from-a-file-with-in-it/#findComment-225322 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.