Sorry for the confusing sounding title
I have some rows from a database that I have performed array_flip() on, and I have also ordered each sub-array by values using some complicated sorting patterns
I now have data in the form:
array(
'col1' => (0=>'value',1=>'value',2=>'value',3=>'value')
'col2' => (1=>'value',2=>'value',0=>'value',3=>'value')
'col3' => (0=>'value',2=>'value',1=>'value',3=>'value')
Note that the 0,1,2,3 are not in order for each sub-array
What I want is to come up with an order that is the average across all columns, in the case of these 3 it would be: 0, 2, 1, 3
I then want to apply this order to all columns, so they are all in the order 0, 2, 1, 3
I can then flip the columns back again, and re-insert into a new table, then happy days all my items are in order
It is probably an easy problem, but I am just not seeing the solution, could anybody please point me in the right direction?
Note: Column count and column names varies