I have a 2 arrays as
$check_string = array("www.salmat.", "www.webcentral.", "abpages.");
and
$files = array("http_www.salmat.com.au_.png", "http_www.webcentral.com.au_.png");
And now i want to check if value of each element in array $check_string matches with atleast part of a string of each element of array $files and if it does not match then i will echo respective values $check_string.
So i am doing with array_filter function
foreach ($check_string as $final_check)
{
function my_search($haystack)
{
global $final_check;
$needle = $final_check;
return(strpos($haystack, $needle));
}
$matches[] = array_filter($files, 'my_search');
if(empty($matches))
{
echo $final_check;
echo "</br>";
}
}
But with this code i get an error
Fatal error: Cannot redeclare my_search() (previously declared in same file)
Can any one suggest any solution
i refereed this and this but cannot get through the solution Thankyou