What is the most efficient way of turning a sample data.csv file such as this:PHP Code:$keys = array('name', 'address');
handle = fopen("data.csv", "r") ;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
// ?
}
into an associated array such asCode:name, address "C Stunt", "Letsby Avenue" "Ishood Coco", "Arfway house"
Naturally the real csv file has many more columns than this, I just wondered if there was an easy way of doing it, rather than re-assigning the values by hand?Code:$arr[0]['name'] = "C Stunt" ; $arr[0]['address'] = "Letsby Avenue" ; $arr[1]['name'] = "Ishood Coco" ; $arr[1]['address'] = "Arfway house" ;











Bookmarks