title: Loop through json array and group by key values
body: <p>After json_decode I have the following Array :::</p>
  
  <pre><code>$json = Array ( [name] =&gt; Array ( [0] =&gt; Peter [1] =&gt; David ) [dep] =&gt; Array ( [0] =&gt; accounts [1] =&gt; sales ) [date] =&gt; Array ( [0] =&gt; 10/27/2015 [1] =&gt; 09/25/2015 ) );
  </code></pre>
  
  <p>How can I group the values by key so I get the following in a PHP foreach loop ? :::</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;Peter, accounts, 10/27/2015&lt;/li&gt;
      &lt;li&gt;David, sales, 09/25/2015&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I've tried a similar foreach loop ( see below ) without the desired results, I'm able to print all the key &amp; value's but I'm not able to group values by key eg. [1] :::</p>
  
  <pre><code>foreach($json as $row){
      foreach($row as $key=&gt;$val){
          echo $key . ': ' . $val . '&lt;br&gt;';
      }
  }
  </code></pre>
  
  <p>Any assistance would be appreciated :::</p>