I have an array from a CSV import that I want to group together based on an ID.
The structure is as follows:
Each row is a measure and a comment added to a submission. There can be multiple rows for one submission. For example, if there are 3 measures, then the headline submission data will be repeated 3 times, with different comments/measure details.
[0] => Array
(
[0] => 1
[1] => Lot
[2] => Lot Submission
[3] => Lot Submission
[4] => Lot Submission
[5] => LNW North
[6] => C Spencer Ltd
[7] => Panel
[8] => 1
[9] => Buildings
[10] => 2015/2016
[11] => 2
[12] => 1,2,3,4,5,6,7,8
[13] => Testing notes
[14] => KPI1 - Behavioural Safety
[15] => PER1 - Health, Safety, and Wellbeing strategy
[16] => Testing Comment 1
[17] => Expected
)
[1] => Array
(
[0] => 1
[1] => Lot
[2] => Lot Submission
[3] => Lot Submission
[4] => Lot Submission
[5] => LNW North
[6] => C Spencer Ltd
[7] => Panel
[8] => 1
[9] => Buildings
[10] => 2015/2016
[11] => 2
[12] => 1,2,3,4,5,6,7,8
[13] => Testing notes
[14] => KPI1 - Behavioural Safety
[15] => PMTEST - Test
[16] => Testing 2
[17] => Stretch
)
[2] => Array
(
[0] => 1
[1] => Lot
[2] => Lot Submission
[3] => Lot Submission
[4] => Lot Submission
[5] => LNW North
[6] => C Spencer Ltd
[7] => Panel
[8] => 1
[9] => Buildings
[10] => 2015/2016
[11] => 2
[12] => 1,2,3,4,5,6,7,8
[13] => Testing notes
[14] => KPI1 - Behavioural Safety
[15] => JP001 - Jamie
[16] => Testing 3
[17] => Excellence
)
Parts 0-13 of each array are the same, this is the headline information for each submission. I want to try and add the 14th - 17th parts of the array to a new array. An example is below
[0] => Array
(
[0] => 1
[1] => Lot
[2] => Lot Submission
[3] => Lot Submission
[4] => Lot Submission
[5] => LNW North
[6] => C Spencer Ltd
[7] => Panel
[8] => 1
[9] => Buildings
[10] => 2015/2016
[11] => 2
[12] => 1,2,3,4,5,6,7,8
[13] => Testing notes
['measure'] = array(
[0] = array(
[14] => KPI1 - Behavioural Safety
[15] => PER1 - Health, Safety, and Wellbeing strategy
['comments'] = array(
[16] => Testing Comment 1
[17] => Expected
)
),
[1] = array(
[14] => KPI1 - Behavioural Safety
[15] => PMTEST - Test
['comments'] = array(
[16] => Testing 2
[17] => Stretch
)
),
[2] = array(
[14] => KPI1 - Behavioural Safety
[15] => JP001 - Jamie
['comments'] = array(
[16] => Testing 3
[17] => Excellence
)
)
)
)
I am totally stumped, but have no idea where to start. Can I create a new array and push the data to it depending on the submission ID ([0] => 1 of the array)?
Any help or guidance will be such a massive help