I have two array $A
,$B
$B = Array
(
[0] => Array
(
[id_participant] => 94
[full_name] => soeng makara
)
[1] => Array
(
[id_participant] => 95
[full_name] => sok sao
)
)
$A = Array
(
[0] => Array
(
[id_participant] => 95
[full_name] => sok sao
)
)
Anyone could help me How can I check array $A
in array $B
in that case.
Simply:
if (in_array($A[0], $B))
{
// in array
}
You want to know if the item in $a is in $b?
function checkIfInArray($a, $b)
{
foreach($b as $i)
foreach($a as $x)
if($x['id_participant'] == $i['id_participant']) return true; //Match found
return false; //No Match was found
}