Changing the order of the array contents by performing arithmetic operations in PHP : <p>I have the following array output. </p>

<pre><code>    Array
(
    [0] =&gt; Array
        (
            [student_id] =&gt; 39
            [scored] =&gt; 50
            [out_of] =&gt; 100
        )

    [1] =&gt; Array
        (
            [student_id] =&gt; 40
            [scored] =&gt; 80
            [out_of] =&gt; 100
        )

)
</code></pre>

<p>I want to calculate the percentage of the student and want to show the student on top whose percentage is higher. how do i  do it? Can i change the order in the array itself? please help</p>

<p>I want the array to be like this </p>

<pre><code>Array
(
    [0] =&gt; Array
        (             
            [student_id] =&gt; 40
            [scored] =&gt; 80
            [out_of] =&gt; 100
        )

    [1] =&gt; Array
        (
            [student_id] =&gt; 39
            [scored] =&gt; 50
            [out_of] =&gt; 100
        )

)
</code></pre>
