title: How to split php array into two arrays following some condition?
body: <p>I want to split an array according to <code>sub_id</code></p>
  <p>my main array:</p>
  <pre><code>$my_main_array = [
      ['id' =&gt; 1, 'sub_id' =&gt; 8],
      ['id' =&gt; 2, 'sub_id' =&gt; 9],
      ['id' =&gt; 3, 'sub_id' =&gt; 8],
      ['id' =&gt; 3, 'sub_id' =&gt; 9],
      ['id' =&gt; 3, 'sub_id' =&gt; 9],
  ];
  </code></pre>
  <p>The result should be,The first array:</p>
  <pre><code>    sub_id equal 8
      sub_id equal 8
  </code></pre>
  <p>The second array</p>
  <pre><code>        sub_id equal 9
          sub_id equal 9
          sub_id equal 9
      
  </code></pre>