Skip to content
Advertisement

How to print rows of CSV file with PHP?

Here’s the code that I’m using, but it doesn’t output exactly what I want.

JavaScript

Here’s what it outputs currently:

JavaScript

In other words, it’s almost as if it’s adding all my CSV data into a multidimensional array…

What I want is to just output it as I see it like so:

JavaScript

Advertisement

Answer

How to parse a CSV file using PHP has interesting suggestions

btw in php 7.2 this would work too:

JavaScript

also, the quotes on the .csv data should enclose all data such as:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement