I have a number of records like these:
2011-01-01, a, 1
2011-01-01, c, 5
2011-01-01, d, 3
2011-01-02, a, ...
The first value is a date, the second is a string (can be a
or b
or c
or d
), and the third is a number.
How can I add all the records into an array in PHP, and the array's structure is like:
array('2011-01-01' => array('a' => '1','b' => '0','c' => '5','d' => '3'), '2011-01-02' => ... ,)
so that the date variable is an index, and the key is a four-element array, each element is the corresponding record number (third value)?