title: Compare and replace value with another array
body: <p>I have the following arrays:</p>
  
  <pre><code>$files = ['376840000000367020', '376840000000375036', '376840000000389001'];
  $arr   = [];
  
  foreach ($files as $key =&gt; $name) {
      $arr[] = $name;
  }
  
  $data = [
      '376840000000367020' =&gt; '5782',
      '376840000000375036' =&gt; '5783',
      '376840000000389001' =&gt; '5784',
  ];
  
  print_r($arr);
  </code></pre>
  
  <p>This returns:</p>
  
  <pre><code>Array ( [0] =&gt; 376840000000367020 [1] =&gt; 376840000000375036.... )
  </code></pre>
  
  <p>I want to compare 2 arrays <code>$arr</code> and <code>$data</code> if the <code>$key</code> is found in <code>$arr</code> replace value with the <code>$data</code>, I'm trying get following output:</p>
  
  <pre><code>Array ( [0] =&gt; 5782 [1] =&gt; 5783 .... )
  </code></pre>
  
  <p>I have lots of data to compare so its not ideal to iterate over <code>$arr</code> inside foreach. </p>
  
  <p>How would i go about doing this?</p>