Reading CSV values and showing them in PHP

Question

I have a project going on and this is the first time I’ve encountered CSV. I’ve read numerous post but haven’t found what I need.

So we have and CSV with values like this

Name,Country,Color,Pet
David,UK,Red,Dog
Andy,USA,Blue,Cat,Dog,Fish
...

So sometimes there are multiple values on “Pet”, and that’s how clients software outputs CSV and we can’t change it.
I am looking for solution on how to combine columns after nth column. So for an example, after 6th column I need ti combine all columns in row to 7th.

Is that possible to achieve?

I would paste the code I’m working on but it’s sample I’ve found online using fgetcsv function and outputing table.

Also, is it possible to read rows instead of columns like it renders it?

Anyone who helps out will do HUGE favor!

0
David 2 months 0 Answers 9 views 0

Leave an answer