I have an array created by using str_getcsv():
$array = array_map('str_getcsv', file($file['tmp_name']));
array_walk($array, function(&$a) use ($array) {
    $a = array_combine($array[0], $a);
});
array_shift($array);
The returned $array outputs this from var_dump($array).
array(18) {
  ["fund"]=>
  string(6) "Fund 1"
  ["name"]=>
  string(13) "Property Name"
  ["investment"]=>
  string(13) "Investment Name"
  ["region"]=>
  string(6) "London"
  ["sector"]=>
  string(6) "Office"
  ["status"]=>
  string(8) "Published"
  ["description"]=>
  string(0) ""
  ["acquisition_date"]=>
  string(0) ""
  ["size"]=>
  string(0) ""
  ["address_line_1"]=>
  string(0) ""
  ["address_line_2"]=>
  string(0) ""
  ["city"]=>
  string(6) "London"
  ["county"]=>
  string(0) ""
  ["postcode"]=>
  string(0) ""
  ["longitude"]=>
  string(0) ""
  ["latitude"]=>
  string(0) ""
  ["featured"]=>
  string(0) ""
  ["external_link"]=>
  string(0) ""
}
When I try and access $array['fund'];, I get Notice: Undefined index: fund. My first thought was that fund had a hidden character in the key name from the CSV headers because $array['name'] works, but I've checked and the only hidden characters are CR LF.
I've seen similar problems on StackOverflow for multi-dimensional arrays, but not for single dimension arrays.
Any help would be greatly appreciated. I've even tried casting to StdClass and $array->fund and get a similar error about property not existing.
I've tried renaming the first header column name to whatever, and it still has issues with it, so I'm wondering if it's a problem accessing the first key.