title: Array - custom foreach function
body: <p>I have an array in this form:</p>
  
  <pre><code>$data = array(
          array(
              'id' =&gt; '1',
              'bar' =&gt; 'foo',
              'page' =&gt; 'front',
           ),
          array(
              'id' =&gt; 'bar',
              'bar' =&gt; 'foo',
              'page' =&gt; 'front',
           ),
          array(
              'id' =&gt; 'different,
              'bar' =&gt; 'bar',
              'page' =&gt; 'back',
           ),
          array(
              'id' =&gt; 'another',
              'title' =&gt; __("Custom CSS",'solidstyle_admin'), 
              'foo' =&gt; 'bar',
              'page' =&gt; 'back',
           ),
  );
  </code></pre>
  
  <p>And I want to list all ids grouped by pages and saved as variables, so if the above array is an input then output will look just like this one:</p>
  
  <pre><code>$front = array('1','bar');
  $back = array('different','another');
  //$data['page'] = array($id1, $id2, (...));
  </code></pre>
  
  <p>I was trying to do that using foreach and this is how it starts:</p>
  
  <pre><code>function my_output() {
       foreach($data as $something) {
          $id = $something['id'];
          $page = $something['page'];
  
      }
     return $output;
  }
  </code></pre>
  
  <p>I was trying multiple foreach loops, and the best result I got was:</p>
  
  <pre><code>front = 1
  front = bar
  back = different
  back = another 
  </code></pre>
  
  <p>But I have absolutely no idea how to achieve what I want to do, I don't want anyone to do my job, just any hints? Keep in mind I'm a bit new to PHP and I don't know too much about arrays.</p>
  
  <p>Thank you!</p>