Sort Array in PHP
<p>I have a script which gets some values from a DB.</p>

<p>The structure of the vars is as the following:</p>

<pre><code>$dump["likes"] = 1234;
$likes["data"][$i]["name"] = "ABCDEFG";

for($i=0;$i&lt;=$max;$i++){
    $data[$i]["likes"] = $dump["likes"];
    $data[$i]["name"] = $likes["data"][$i]["name"];

}

//Print sorted array here (highest value in "like" first)
</code></pre>

<p>I just need a way to find out in which entry the biggest "likes" are :)</p>

<p>So far i have tried array_multisort, but it showed me "inconsistent size" or some error...</p>

<p>Thanks for all your help!</p>

<p>EDIT:</p>

<p>When i print($data) outside of the end loop it looks like this:</p>

<pre><code>Array ( [0] =&gt; Array ( [likes] =&gt; 3485109 [name] =&gt; Google ) [1] =&gt; Array ( [likes] =&gt; 78535 [name] =&gt; Youtube ) [2] =&gt; Array ( [likes] =&gt; 2433041 [name] =&gt; Bing ))
</code></pre>

<p>I would like to have an array like this:</p>

<pre><code>Array ( [0] =&gt; Array ( [likes] =&gt; 3485109 [name] =&gt; Google ) [1] =&gt; Array ( [likes] =&gt; 2433041 [name] =&gt; Bing ) [2] =&gt; Array ( [likes] =&gt; 78535 [name] =&gt; Youtube ))

//Sorted by "likes"
</code></pre>
