Normally I\'d be asking how to turn something like this:
1 2 3
4 5 6
7 8 9
10 11 12
Into this:
Modified version of the "accepted" answer, which works MUCH better IMHO:
function array2DFlip($arr) {
if(!is_array($arr) || count($arr) < 1 || !isset($arr[0])) return array();
$out = array();
foreach($arr as $row_id => $row){
foreach($row as $col_id => $val){
$out[$col_id][$row_id] = $val;
}
}
return $out;
}