<?php $first = array('e', 'h', 'r', 'j', 'b'); $last = array('w', 'e', 'c'); $diff = array_diff($last, $first); echo '<p>'; foreach ($diff as $v) { echo "{$v} "; } echo "</p>\n"; ?>