fork download
  1. <?php
  2.  
  3.  
  4. $needle = [486, 987];
  5. $haystack = ["247-16-02-2009", "486-16-02-2009", "562-16-02-2009", "1257-16-02-2009", "486-16-02-2009"];
  6.  
  7. $result = array_filter($haystack, function($item) use ($needle){
  8. foreach($needle as $v){
  9. if(strpos($item, strval($v)) !== false){
  10. return true;
  11. }
  12. }
  13. return false;
  14. });
  15.  
  16. print_r($result);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [1] => 486-16-02-2009
    [4] => 486-16-02-2009
)