Using the array_intersect () Function
<?php
$arrayone = array ("A", "B", "C", "D");
$arraytwo = array ("C", "D", "E", "F");
$similarity = array_intersect ($arrayone, $arraytwo);
foreach ($similarity as $val) {
echo "$val", "\n";
}
?>
Related examples in the same category