I have csv values like this:
$csv_data = "test,this,thing
hi,there,this
is,cool,dude
have,fun";
I want to take an entire CSV string and read it into a multidemensional array so that I get:
array(
array(
'test' => 'hi',
'this' => 'there',
'thing' => 'this'
),
array(
'test' => 'is',
'this' => 'cool',
'thing' => 'dude'
),
array(
'test' => 'have',
'this' => 'fun',
'thing' => ''
)
);
I want an output like that, take note that the CSV value is dynamic.
have,fun, which only has two columns, not three like the other lines. Do we need to account for rows that have the wrong number of columns like that?