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] Link to comment https://forums.phpfreaks.com/topic/215872-removing-double-quotation-marks/ 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 Link to comment https://forums.phpfreaks.com/topic/215872-removing-double-quotation-marks/#findComment-1122198 Share on other sites More sharing options...
sasori Posted October 14, 2010 Author Share Posted October 14, 2010 cool, thanks...am sooo noob lol Link to comment https://forums.phpfreaks.com/topic/215872-removing-double-quotation-marks/#findComment-1122201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.