csv to array

How would I convert a csv file as such:

store_code,product_sku,status
store1,prsku1,Low
store2,prsku2,Yes
store3,prsku1,Yes

To a php array like this:

Array ( [0] => store1 [1] => prsku1 [2] => Array ( [status] => Low ) [1] => store2 [1] => prsku2 [2] => Array ( [status] => Yes ) [2] => store3 [1] => prsku1 [2] => Array ( [status] => Yes ) )

Appreciate any help.

Look at some of the examples here…

http://www.php.net/manual/en/function.str-getcsv.php

It’ll get you pointed in the right direction.

Sponsor our Newsletter | Privacy Policy | Terms of Service