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 ,) Quote 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 Quote 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); ?> Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/250182-split-a-csv-file/#findComment-1283782 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.