title: PHP Loops & array_filter
body: <p>I have the following code which works fine if there is only 1 value in <code>$array1</code>, but if there are 2 or more values in <code>$array1</code>, it returns an empty array. I need it to match all values from <code>$array1</code>.</p>
  
  <pre><code>$array1Imploded = implode(", ", $array1);
  foreach ($array1 as $m) {
      $m = array_filter($array2, function($var) use ($array1Imploded) { return preg_match("#\b$array1Imploded\b#i", $var); });
  }
  print_r($m);
  </code></pre>
  
  <p>What am I doing wrong please? I'm guessing it has something to do with the commas and spaces in <code>$array1Imploded</code> but I'm not really sure how to work around them.</p>