I am working with php and trying to use “in_array”,I want if my posted value exist in
file then “success” msg should display otherwise “not matching” should display but right now i am always
getting “matching” message even after send wrong data,Here is my array
Array
(
[0] => Array
(
[email] => [email protected]
[link] => test1,test2
)
...
)
I tried with following code
//$set_excel_query_all (containing all array values)
$keyword="test3";
foreach ($set_excel_query_all as $key => &$item) {
if ($item['email'] == $searchEmail) {
$data =explode(',', $item['link']);
if(in_array($keyword, $data)){
echo "matching";
}
else
{
echo "not matching";
}
}
}