I have an array that outputs numerous arrays, but if some of the codes are the same, they all output in the same array. How do I separate them?
[
[ [ '0011', 6, 96, '2021-08-16' ], [ '0011', 2, 4, '2021-08-17' ] ],
[ [ '0032', 20, 26, '2021-08-16' ] ],
[ [ '0098', 6, 246, '2021-08-16' ], [ '0098', 0, 0, '2021-08-17' ] ],
[ [ '0093', 2, 30, '2021-08-16' ] ],
[ [ '0051', 32, 229, '2021-08-16' ] ],
[ [ '0053', 27, 63, '2021-08-16' ], [ '0053', 2, 38, '2021-08-17' ] ],
[ [ '0022', 4, 2, '2021-08-16' ], [ '0022', 6, 12, '2021-08-17' ] ],
[ [ '0067', 2, 144, '2021-08-16' ] ],
[ [ '0166', 4, 102, '2021-08-16' ] ],
[ [ '0015', 4, 96, '2021-08-16' ] ],
]
How do I retrieve the values that have two or more values in their array and put them in so that each one is distinct within the array, if that makes sense?
[
[ [ '0011', 6, 96, '2021-08-16' ]],
[[ '0011', 2, 4, '2021-08-17' ] ],
[ [ '0032', 20, 26, '2021-08-16' ] ],
[ [ '0098', 6, 246, '2021-08-16' ],
[ [ '0098', 0, 0, '2021-08-17' ] ],
[ [ '0093', 2, 30, '2021-08-16' ] ],
[ [ '0051', 32, 229, '2021-08-16' ] ],
[ [ '0053', 27, 63, '2021-08-16' ]],
[ [ '0053', 2, 38, '2021-08-17' ] ],
[ [ '0022', 4, 2, '2021-08-16' ]],
[ [ '0022', 6, 12, '2021-08-17' ] ],
[ [ '0067', 2, 144, '2021-08-16' ] ],
[ [ '0166', 4, 102, '2021-08-16' ] ],
[ [ '0015', 4, 96, '2021-08-16' ] ],
]
Or
[
[ '0011', 6, 96, '2021-08-16' ],
[ '0011', 2, 4, '2021-08-17' ],
[ '0032', 20, 26, '2021-08-16' ],
[ '0098', 6, 246, '2021-08-16' ],
[ '0098', 0, 0, '2021-08-17' ],
[ '0093', 2, 30, '2021-08-16' ],
[ '0051', 32, 229, '2021-08-16' ],
[ '0053', 27, 63, '2021-08-16' ],
[ '0053', 2, 38, '2021-08-17' ],
[ '0022', 4, 2, '2021-08-16' ],
[ '0022', 6, 12, '2021-08-17' ],
[ '0067', 2, 144, '2021-08-16' ],
[ '0166', 4, 102, '2021-08-16' ],
[ '0015', 4, 96, '2021-08-16' ],
]
I tried flatten, but it only added the arrays in the same array together, which isn't what I wanted.