I have two arrays, I need to find out the value for each of the array which is the same.
For example,
$arr1=array("a", "b", "c");
$arr2=array("c", "d", "e");
Then c should be display. How could I do this?
$word1 =array('a', 'b','c', 'd');
$word2 =array('b', 'c', 'd', 'a');
$data = array_intersect($word1, $word2);
it will return a,b,d because that is common in both array
print_r( $data );
/* result:
Array (
[0] => a
[1] => b
[3] => d
) */