<?php
$exclusions = [
'Discontinue Status' => [
'Discontinued',
'Run Down Stock',
],
'Hazardous' => [
'No',
],
];
$products = [
[
'Product ID' => '452',
'Discontinue Status' => 'Discontinued',
'Hazardous' => 'No',
],
[
'Product ID' => '463',
'Discontinue Status' => 'Normal',
'Hazardous' => 'No',
],
[
'Product ID' => '477',
'Discontinue Status' => 'Run Down Stock',
'Hazardous' => 'Yes',
],
[
'Product ID' => '502',
'Discontinue Status' => 'Discontinued',
'Hazardous' => 'No',
],
[
'Product ID' => '520',
'Discontinue Status' => 'Normal',
'Hazardous' => 'Yes',
],
];
var_export(
array_values(
array_filter(
$products,
fn($product) => !array_filter(
array_intersect_key($product, $exclusions),
fn($value, $key) => in_array($value, $exclusions[$key]),
ARRAY_FILTER_USE_BOTH
)
)
)
);
preferences:
29.23 ms | 402 KiB | 5 Q