title: If value of first array is found on second array, replace and echo it
body: <p>I have 2 arrays:</p>
  
  <pre><code>$array1 = array('first', 'second', 'third', 'fourth');
  $array2 = array('second' =&gt; 'bye', 'first' =&gt; 'hello',  'third' =&gt; 'see you', 'fifth' =&gt; 'good evening');
  </code></pre>
  
  <p>and I echo the content of <code>$array1</code> like</p>
  
  <pre><code>foreach ($array1 as $extra) {
  echo $extra; }
  </code></pre>
  
  <p>What I am trying to do is to check every time before echoing the <code>$extra</code> whether the output is found in <code>$array2</code>. And if yes, to echo the value of the <code>array2</code> instead.</p>
  
  <p>So in my example above, instead of <code>first second third fourth</code> I want to echo <code>hello bye see you fourth</code>.</p>
  
  <p>How can I do this?</p>