i have two arrays in php and i am using the array_intersect function to find the common elements and if common elements exists i want to display the index of theses common elements in the 1st array
here is what i have done so far..
function check_if_exists($company_timings,$in_time)
{
$length_of_company=sizeof($company_timings);
$length_of_emp=sizeof($in_time);
$common=array_intersect($company_timings,$in_time);
$length_of_common=sizeof($common);
$key=array_search($common,$company_timings);
return $key;
}
but its not return the keys there are common elements which are 09:00:00 and 11:00:00 and when i pass 11:00:00 rather than $common in array_search then it gives the accurate result other wise with the $common_array it doesn't work,,,kindly help me in ameliorating the code