3v4l.org

run code in 300+ PHP versions simultaneously
<?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', ], ]; $result = []; foreach ($products as $product) { foreach (array_intersect_key($product, $exclusions) as $key => $value) { if (in_array($value, $exclusions[$key])) { continue 2; } } $result[] = $product; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'Product ID' => '520', 'Discontinue Status' => 'Normal', 'Hazardous' => 'Yes', ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.04 ms | 401 KiB | 8 Q