Friday, July 31, 2009

How to put in arrays into multidimensional arrays? (php)?

I have 2 arrays, $a, $b. I want to create a multidimensional array with these two arrays, as well as an index.





I've tried several things, but nothing is working - In my searches, nothing was found either. Here's my most recent attempt at a solution:





for($x=0;$x%26lt;sizeof($a);$x++)


{


$c = array(id =%26gt; $x, array( "A1" =%26gt; $a[$x],


"B1" =%26gt; $b[$x]));


}





Any help is appreciated.

How to put in arrays into multidimensional arrays? (php)?
Do you want a 2-dimensional array that contains these 2 arrays? If so, this should work:





$c = array($a, $b);





or





$c = array("A1" =%26gt; $a, "B1" =%26gt; $b);
Reply:Use objects not arrays.


No comments:

Post a Comment