I am having trouble generating a multidimensional array from a csv file. I need to have the output 'grouped' by country as each country may have multiple networks. Some rows do not have a value for country or zone as they are related to the row above it. Unfortunately this is how i receive the csv file and there is no way of changing the output. Any feedback or pointers would be appreciated.
Snippet of csv file...
Country|Zone|Network|Video|Voice
Afghanistan,5,Afghan Wireless,No,Yes
,,Roshan,No,Yes
Antigua,4,Digicel,No,Yes
Argentina,5,Telecom Personal,Yes,Yes
,,Movistar,No,Yes
,,Movistar2,Yes,Yes
Aruba,4,Digicel,No
Ideal Output
Array (
[0] => Array (
[country] => Afghanistan
[zone] => 5
[network] => Array (
[0] => Array (
[name] => Afghan Wireless
[video] => No
[voice] => Yes
)
[1] => Array (
[name] => Roshan
[video] => No
[voice] => Yes
)
)
)
[1] => Array (
[country] => Antigua
[zone] => 4
[network] => Array (
[0] => Array (
[name] => Digicell
[video] => No
[voice] => Yes
)
)
)
etc...
)