title: Join array values and keys between two php arrays
body: <p>I need to merge (sort of join) two arrays with both same keys, and in result i want to have the values of the first as keys of the second one :</p>
  <p>Example :</p>
  <pre><code>$keyArray = [
  &quot;key1&quot; =&gt; &quot;map1&quot;,
  &quot;key2&quot; =&gt; &quot;map1&quot;,
  &quot;key3&quot; =&gt; &quot;map2&quot;,
  &quot;key4&quot; =&gt; &quot;map3&quot;
  ];
  
  $valuesArray = [
  &quot;key1&quot; =&gt; &quot;value1&quot;,
  &quot;key2&quot; =&gt; &quot;value2&quot;,
  &quot;key3&quot; =&gt; &quot;value3&quot;,
  &quot;key4&quot; =&gt; &quot;value3&quot;
  ];
  </code></pre>
  <p>// expected result :</p>
  <pre><code>$mappedResultArray = 
  [
    &quot;map1&quot; =&gt; [
      &quot;value1&quot;,
      &quot;value2&quot;
    ],
    &quot;map2&quot; =&gt; [
      &quot;value3&quot;
    ],
    &quot;map3&quot; =&gt; [
      &quot;valu3&quot;
    ],
  ];
  </code></pre>
  <p>I know that this is possible by using php loops/foreach through both arrays,
  But I want to have a solution using PHP array_* functions (array_map, array_merge ....)</p>