Split array by key inside
<p>I have an array like this:</p>

<pre class="lang-php prettyprint-override"><code>Array (
    0 =&gt; Array ( 
        'id' =&gt; 1,
        'name' =&gt; 'Hack n\' Slash',
        'slug' =&gt; 'hack-n-slash',
        'popular' =&gt; 0
    ),
    1 =&gt; Array ( 
        'id' =&gt; 2,
        'name' =&gt; 'FPP',
        'slug' =&gt; 'fpp',
        'popular' =&gt; 1
    ),  
    2 =&gt; Array ( 
        'id' =&gt; 3,
        'name' =&gt; 'RPG',
        'slug' =&gt; 'rpg',
        'popular' =&gt; 1
    )
)
</code></pre>

<p>What I want, is to split it into two arrays by key <code>popular</code>, so I'll have a list like:</p>

<p>Popular:</p>

<ul>
<li>one</li>
<li>two</li>
</ul>

<p>Non-popular:</p>

<ul>
<li>one</li>
<li>two</li>
</ul>

<p>I tried using if/else like this:</p>

<pre><code>foreach($genres as $genre) : 
    if($genre['popular'] == '1' : 
        echo $genre['name']; 
    endif; 
endforeach;
</code></pre>

<p>But then, when I added another statement (<code>if($genre['popular'] == '0')</code>), I couldn't use it, since it was quite messy.</p>

<p>How can I achieve this?</p>
