Is there any fast way to get all subarrays where a key value pair was found in a multidimensional array? I can't say how deep the array will be.

Simple example array:

$arr = [
    ['id' => 1, 'name' => 'cat 1'],
    ['id' => 2, 'name' => 'cat 2'],
    ['id' => 3, 'name' => 'cat 1']
];

When I search for key name and value cat 1, the function should return:

[
    ['id' => 1, 'name' => 'cat 1'],
    ['id' => 3, 'name' => 'cat 1']
]

I guess the function has to be recursive to get down to the deepest level.

Edit
Report