How do you rotate a two dimensional array?
http://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array This is the best so far I have come up with PHP, can anyone refine this for me?? $b = array(); $a = array(array(1,2,3,4),array(5,6,7,8),array(9,0,1,2),array(3,4,5,6)); while(count($a)>0) { $b[count($a[0])-1][] = array_shift($a[0]); if (count($a[0])==0) { array_shift($a); } }