Array Intersection
<?php
$first = array('e', 'h', 'r', 'j', 'b');
$last = array('w', 'e', 'c');
$intersection = array_intersect($last, $first);
echo '<p>';
foreach ($intersection as $v) { echo "{$v} "; }
echo "</p>\n";
?>
Related examples in the same category