<?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"; } ?>