I have a string that looks like the below:
Name,Age,Location
Jo,28,London
How would I convert this into an associative array so it reads like this:
Array
(
[Name] => Jo
[Age] => 28
[Location] => London
)
I've tried to explode the string and manipulate it that way but got nowhere fast ($body = explode(',', $body);
) I tried to use array_map()
but it expected an array in the first place.
I've looked through a few articles (PHP CSV to Associative Array with Row Headings) but again they are using array_map()
.