title: How to combine multidimensional array values and key?
body: <p>I have this following array</p>
  
  <pre><code>array (
    1 =&gt; 
    array (
      't' =&gt; 
      array (
        0 =&gt; 't1',
        1 =&gt; 't2',
        2 =&gt; 't3',
      ),
      'c' =&gt; 
      array (
        0 =&gt; 'c1',
        1 =&gt; 'c2',
        2 =&gt; 'c3',
      ),
      'd' =&gt; 
      array (
        0 =&gt; 'd1',
        1 =&gt; 'd2',
        2 =&gt; 'd3',
      ),
    ),
    2 =&gt; 
    array (
      'j' =&gt; 
      array (
        0 =&gt; 'j1',
        1 =&gt; 'j2',
        2 =&gt; 'j3',
      ),
      'm' =&gt; 
      array (
        0 =&gt; 'm1',
        1 =&gt; 'm2',
        2 =&gt; 'm3',
      ),
      'n' =&gt; 
      array (
        0 =&gt; 'n1',
        1 =&gt; 'n2',
        2 =&gt; 'n3',
      ),
    ),
  )
  </code></pre>
  
  <p>And I need the output to be</p>
  
  <pre><code>array(
     1=&gt;array(
        't-j'=&gt;array('t1-j1','t2-j2','t3-j3'),
        'c-m'=&gt;array('c1-m1','c2-m2','c3-m3'),
        'd-n'=&gt;array('d1-n1','d2-n2','d3-n3')
        )
  );
  </code></pre>
  
  <p>And What I've done is as</p>
  
  <pre><code>$i = 0;
  $res = [];
  foreach($arr[1] as $key =&gt; $value){
      foreach($arr[2] as $k =&gt; $v){
          $res[$key.'-'.$k][] = $value[$i].'-'.$v[$i];
      }
          $i++;
  }
  </code></pre>
  
  <p>But that gives me something like this?</p>
  
  <pre><code>Array
  (
      [t-j] =&gt; Array
          (
              [0] =&gt; t1-j1
          )
  
      [t-m] =&gt; Array
          (
              [0] =&gt; t1-m1
          )
  
      [t-n] =&gt; Array
          (
              [0] =&gt; t1-n1
          )
  
      [c-j] =&gt; Array
          (
              [0] =&gt; c2-j2
          )
  
      [c-m] =&gt; Array
          (
              [0] =&gt; c2-m2
          )
  
      [c-n] =&gt; Array
          (
              [0] =&gt; c2-n2
          )
  
      [d-j] =&gt; Array
          (
              [0] =&gt; d3-j3
          )
  
      [d-m] =&gt; Array
          (
              [0] =&gt; d3-m3
          )
  
      [d-n] =&gt; Array
          (
              [0] =&gt; d3-n3
          )
  
  )
  </code></pre>
  
  <p>So I've searched many of links over here and tried at least most of things that can be possible by me. But I couldn't get the most of it</p>