title: PHP assign one array's values as a keys to another array's values if both arrays keys matches
body: <pre><code>&lt;?php
  echo '&lt;pre&gt;';
  
  $directnames = array("LN"=&gt;"ListingId","LAG"=&gt;"AgentCode","ST"=&gt;"MlsStatus","LP"=&gt;"ListPrice","PIC"=&gt;"PhotosCount");
  
  $result = array("LN"=&gt;"129_551453","LAG"=&gt;"2.50","ST"=&gt;"3.00","LP"=&gt;"Ferndale","PIC"=&gt;"359900.00");
  
  
  $directnames_getkeys = array_keys($directnames);
  $result_getkeys = array_keys($result);
  $merge_keys = array_intersect($directnames_getkeys,$result_getkeys);
  $assigning = array();
  
  foreach($merge_keys as $preparevalues){
      foreach($directnames[$preparevalues] as $keys){
          echo $assigning[$keys] = $result[$preparevalues];
      }
  }
  
  
  echo '&lt;/pre&gt;';
  ?&gt;
  </code></pre>
  
  <p><strong>Expected output:</strong></p>
  
  <pre><code>array(
      "ListingId"=&gt;"129_551453",
      "AgentCode"=&gt;"2.50",
      "MlsStatus"=&gt;"3.00",
      "ListPrice"=&gt;"Ferndale",
      "PhotosCount"=&gt;"359900.00"
      )
  </code></pre>