2

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?

mickmackusa
  • 43,625
  • 12
  • 83
  • 136
MarinaGB
  • 21
  • 5

0 Answers0