sasori Posted October 14, 2010 Share Posted October 14, 2010 hello, i have this text file attached, and I am currently extracting the data from it. and yeah, I know how..but the problem is the double quotation marks. the last double quotation mark doesn't go away,,,am also aware that trim() only accepts strings. but how come, it does remove the first double quotation mark and leave the 2nd one. here's my script, feel free to download the file and try my script in your own localhost and tell me what's wrong . Thanks in advance $fh = fopen('iso3166.txt','r'); while(!feof($fh)) { $lines = fgets($fh); $parts = explode(",",$lines); print trim($parts[1],'"')."<br />"; } fclose($fh); [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 14, 2010 Share Posted October 14, 2010 I would use the function fgetcsv to read the file: <?php $fp = fopen('iso3166.txt','r'); while (($data = fgetcsv($fp, 1000, ",")) !== FALSE) { print_r($data); } fclose($fp); ?> Ken Quote Link to comment Share on other sites More sharing options...
sasori Posted October 14, 2010 Author Share Posted October 14, 2010 cool, thanks...am sooo noob lol Quote Link to comment 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.