Note that there are some explanatory texts on larger screens.

plurals
  1. POSorting a Multidimensional array
    primarykey
    data
    text
    <p>I need to sort an array that can look like this:</p> <pre><code>$array[4][0] = array('id' =&gt; 1, 'value' =&gt; 2); $array[3][2] = array('id' =&gt; 0, 'value' =&gt; 3); $array[4][1] = array('id' =&gt; 1, 'value' =&gt; 0); $array[1][3] = array('id' =&gt; 2, 'value' =&gt; 1); $array[1][1] = array('id' =&gt; 3, 'value' =&gt; 0); $array[3][0] = array('id' =&gt; 2, 'value' =&gt; 1); $array[3][1] = array('id' =&gt; 1, 'value' =&gt; 0); $array[1][2] = array('id' =&gt; 3, 'value' =&gt; 2); $array[1][0] = array('id' =&gt; 2, 'value' =&gt; 1); $array[2][1] = array('id' =&gt; 0, 'value' =&gt; 2); $array[2][4] = array('id' =&gt; 3, 'value' =&gt; 1); </code></pre> <p>But needs to be sorted and returned as this:</p> <pre><code>$array[1][0] = array('id' =&gt; 2, 'value' =&gt; 1); $array[1][1] = array('id' =&gt; 3, 'value' =&gt; 0); $array[1][2] = array('id' =&gt; 3, 'value' =&gt; 2); $array[1][3] = array('id' =&gt; 2, 'value' =&gt; 1); $array[2][1] = array('id' =&gt; 0, 'value' =&gt; 2); $array[2][4] = array('id' =&gt; 3, 'value' =&gt; 1); $array[3][0] = array('id' =&gt; 2, 'value' =&gt; 1); $array[3][1] = array('id' =&gt; 1, 'value' =&gt; 0); $array[3][2] = array('id' =&gt; 0, 'value' =&gt; 3); $array[4][0] = array('id' =&gt; 1, 'value' =&gt; 2); $array[4][1] = array('id' =&gt; 1, 'value' =&gt; 0); </code></pre> <p>Can anyone help me? It needs to sort both indexes of the array from lowest to highest index value. Sounds simple enough, but I'm having the hardest time trying to figure this out, while still keeping the values intact.</p> <p>Please help someone...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload