My multi-dimensional array is working. But I cannot seem to use explode or in_array to limit the array when calling via $_GET
<?
$shop = array(
array("red", "black", "blue", "green"),
array("orange"),
array("orange", "black"),
array("pink", "yellow")
);
foreach ($shop as $rowNumber => $row)
{
echo "<li><b>The row number $rowNumber</b>";
echo "<ul>";
foreach ($row as $col) {
if (in_array($col, explode(' and ', $_GET['filter']))){
echo "<li>".$col."</li>";
}
}
echo "</ul>";
echo "</li>";
}
?>
If I run the script with $_GET["filter"]=="black" it displays all items – it should only display two, example this is wrong: the other rows should not appear:

should be this instead

Updated
Solution 1
Solution 2