如何用stristr搜索

i have 2 arrays

$filtered_url_list= array("www.salmat.", "www.webcentral.");

and

 $files = array("http://www.salmat.", "http://www.webcentral.", "http://abc.");

i want to search for elements of $filtered_url_list in array $files. If part of the string of $files' elements match then respective $files' string needs to be echoed

my code looks like this

foreach($filtered_url_list as $check_val)
{
  $found=FALSE;
  foreach($files as $file_val)
  {
    if(stristr($check_val,$file_val)!==FALSE)
    {
        $found=TRUE;
    }
  }
  if(!$found)
  {
    echo $file_val,"
";
  }

} Example :
www.salmat. is present in http://www.salmat. if this is true then echo http://www.salmat. My echo statement is incorrect. But i m not getting how to make it correct

Please suggest

Thankyou

Use strcmp instead

    if(strcmp($check_val,$file_val) ==0)

Try this code:-

foreach($filtered_url_list as $check_val)
{
  if(in_array ($check_val ,$contents))
  {
    //$chcekc_val values is present in $contents array. 
  }
 }

For reference http://php.net/manual/en/function.in-array.php

Put the echo in the foreach. Also, the order of the arguments for the stristr function is wrong.

foreach($filtered_url_list as $check_val)
{
  $found=FALSE;
  foreach($files as $file_val)
  {
    if(stristr($file_val,$check_val)!==FALSE)
    {
      $found=TRUE;
      echo $file_val,"
";
    }
  }
}