0

The code below filters a multidimensional array by the ID of 152.

$new = array_filter($test, function ($output) {
    return ($output['_id'] == 152);
});

Is there a way to make it work with multiple IDs? For example 152, 154, 155

StephenMeehan
  • 1,083
  • 2
  • 15
  • 26

1 Answers1

0

Yes , you can try this :

$new = array_filter($test, function ($output) {
    return (in_array($output['_id'] , [152,154,155]));
});
Yassine CHABLI
  • 3,459
  • 2
  • 23
  • 43