lilya Posted February 4, 2010 Share Posted February 4, 2010 Hello. I wonder if someone could help me in the right direction with this. I have four (large) arrays: array($key1,$key2,$key3....); //(keys are ints from 1,2..) array($a1,$a2,$a3....); // ($a*,$b*,$c* are doubles) array($b1,$b2,$b3....); array($c1,$c2,$c3....); //what I want: $unsorted = array( $sub1 = array($key1,$a1,$b1,$c1); $sub2 = array($key2,$a2,$b2,$c2); $sub3 = array($key3,$a3,$b3,$c3); ... . . ) Many thanks Lily Link to comment https://forums.phpfreaks.com/topic/190916-moving-many-arrays-into-columns-in-multidimensional-array/ Share on other sites More sharing options...
gwolgamott Posted February 4, 2010 Share Posted February 4, 2010 array($key1,$key2,$key3....); //(keys are ints from 1,2..) array($a1,$a2,$a3....); // ($a*,$b*,$c* are doubles) array($b1,$b2,$b3....); array($c1,$c2,$c3....); $unsorted = array( $sub1 = array($key1,$a1,$b1,$c1); $sub2 = array($key2,$a2,$b2,$c2); $sub3 = array($key3,$a3,$b3,$c3); ) $sub1[0] = $key_array[0]; $sub1[1] = $a_array[0]; $sub1[2] = $b_array[0]; $sub1[3]= $c_array[0]; $unsorted[0] = $sub1; Link to comment https://forums.phpfreaks.com/topic/190916-moving-many-arrays-into-columns-in-multidimensional-array/#findComment-1006781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.