order array by subarray element
Posted: Wed Aug 30, 2006 2:30 am
I have something like this:
and i want to order the main array by, lets say, "a", without destroying the main "a" and "b" pairs.
I mean:
the subarrays should not be touched, only the top level array should be rearanged by a subarray element.
how should i do this?
Code: Select all
$array[1]["a"]=rand();
$array[1]["b"]=rand();
$array[1]["a"]=rand();
$array[2]["b"]=rand();
$array[3]["a"]=rand();
$array[3]["b"]=rand();
$array[4]["a"]=rand();
$array[4]["b"]=rand();I mean:
the subarrays should not be touched, only the top level array should be rearanged by a subarray element.
how should i do this?