The ordering of a two-dimensional array in PHP can be implemented in several ways, such as a two-dimensional array below that is sorted by the ' age ' key value.
Two-dimensional arrays:
$arr =[ Array ( ' name ' = ' A ', ' age ' =>28 ), Array ( ' name ' = ' = ' B ', ' age ' =>14 ), Array ( ' name ' = = ' C ', ' age ' =>59 ), Array ( ' name ' = = ' D ', ' Age ' =>23 ), Array ( ' name ' = ' E ', ' age ' =>23 ), Array ( ' name ' = ' = ' F ', ' Age ' =>21 ),];
Sort by ' age ' key value:
Array_multisort (Array_column ($arr, ' age '), Sort_desc, $arr);p rintr ($arr);
where Array_column (an array, a key value in an array) is a single-dimensional array that represents a column that takes a key value out of a multidimensional array;
Array_multisort (Array (one-dimensional arrays), sort (SOTR_ASC,SOTR_DESC), other arrays (which can be two-dimensional) can be used to sort multiple arrays at once, or to sort multidimensional arrays based on one dimension or multidimensional.