cmb Posted October 31, 2011 Share Posted October 31, 2011 How do i specify that i want the fgetcsv() to use a ; to separate instead of a , p.s.(i have no control over the .csv file so i cant change it from ; to ,) Link to comment https://forums.phpfreaks.com/topic/250182-split-a-csv-file/ Share on other sites More sharing options...
xyph Posted October 31, 2011 Share Posted October 31, 2011 Check the manual. You can specify the delimiter and enclosing characters in the function's arguments. http://php.net/manual/en/function.fgetcsv.php Link to comment https://forums.phpfreaks.com/topic/250182-split-a-csv-file/#findComment-1283770 Share on other sites More sharing options...
cmb Posted October 31, 2011 Author Share Posted October 31, 2011 I tried what it said and it did not work this is my code <?php $file = fopen("playerstats.csv","r",";"); while(! feof($file)) { print_r(fgetcsv($file)); echo "<br />"; } fclose($file); ?> Link to comment https://forums.phpfreaks.com/topic/250182-split-a-csv-file/#findComment-1283781 Share on other sites More sharing options...
xyph Posted October 31, 2011 Share Posted October 31, 2011 You applied that to fopen and not fgetcsv. Link to comment https://forums.phpfreaks.com/topic/250182-split-a-csv-file/#findComment-1283782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.