How to group row data from a 2d array by first column values
05:46 18 Apr 2019

I have an array from excel file like this.

$array = [
    ['parent 1', '10000', '20000'],
    ['parent 1', '15000', '21000'],
    ['parent 2', '13000', '22000'],
    ['parent 2', '11000', '5000'],
];

How to convert array above with php to array like this below:

$array = [
    'parent 1' => [
        ['10000', '20000'],
        ['15000', '21000']
    ],
    'parent 2' => [
        ['13000', '22000'],
        ['11000', '5000']
    ]
];
php arrays multidimensional-array grouping sub-array