\n"; echo "----- 1 ----- \n". "----- print_aoa(aars) : \n"; print_aoa($aars); echo "----- 2 -----\n", "----- Now we remove aars[2] to see what happens in the final sort. \n", "----- print_aoa(aars) \n"; unset( $aars[2] ); print_aoa($aars); foreach ( $aars as $iy => &$el_1 ) { $a1[] = $el_1[$ix]; } echo "----- 3 - So you can see that the index key values are 0,1,3,4 \n", "----- Now create the a1 array consisting of aars[$ix] values: \n", "----- note that new array index values are ordered without skipping [2] \n"; print_r($a1); echo "----- 4 - For ha ha's here's that array after regular sort(a2) ---- \n"; $a2 = $a1; sort($a2); print_r($a2); echo "----- 5 - But that's not what array_multisort(a1, aars) wants. \n", "----- It wants the a1 array in the original order.\n", "----- And here is a print of the array now sorted on index[$ix] \n\n"; array_multisort($a1, $aars); print_aoa($aars); echo "\nOK, so pretty good excercise. A lot of new stuff here. \n"; echo " \n"; /*******************************************************************/ function print_aoa($aoa) { foreach ( $aoa as $iy => $el_1 ) { echo $iy; foreach ( $el_1 as $ix => $el_2 ) { echo " ". $el_2 ." "; } echo " \n"; } } ?>