How to group rows of data into subarrays based on another column?

76 Views Asked by At

What is the best way to group data in my multi-dimensional array by one column and crate a subarray of from another column in each group?

$array = [
    ['idAnswer' => 209, 'idQuestion' => 141],
    ['idAnswer' => 1668, 'idQuestion' => 141],
    ['idAnswer' => 211, 'idQuestion' => 142]
];

I need to get: [['209', '1668'], ['211']].

What is the way to do this?

0

There are 0 best solutions below