I have import a csv file in my controller action. The structure of csv file is like given below.
Name , Phone , address
user1 , 99887766 , xyz
user2, 99885566 , hjj
Now I want array of arrays with csv header information as key and row data as value. The required output should be something like this.
[
"0" => [ "Name" => "user1" , "Phone" => "99887766" , "address" => "xyz" ],
"1" => [ "Name" => "user2" , "Phone" => "99885566" , "address" => "hjj" ],
]
I am able to get the row data with php explode. The problem is in setting the key as header given. Can anyone help-me for this.