php - how do you construct an array of arrays in JSON -


If there are many arrays, then they call colors, plants, cars, family each or these arrays equal length 5 items

I want to create another array called grouping like

The group will contain the project in which

  group [0] => (Color => Color [0], Plant => Plant [0], Car => Car [0], Family => Family [0]) Group [1] = & gt; (Color => Color [1] Plant => Plant [1], Car => Car [1], Family => Family [1]) Group [2] = & gt; (Color => Color [2], Plant = & gt Plant [2], Car => Car [2], Family = & Family; [2]) Group [3] = & gt; (Color => Color [3], Plant => Plant [3] Car => Car [3], Family => Family [3]) Group [4] = & gt; (Color => color [4], plant => plants [4], car => car [4], family => family [4])   < P> How can I set it to loop In reality, I have 50 items and each has 13 elements  

and then I would use PHP json_encode to put it in JSON so that I I can move it

I have to meet it in the iOS dictionary. I can call an element of the group and easily access any element

If I call on Group 3 then I can get all matching elements

How will this be setup in PHP

< Div class = "post-text" itemprop = "text"

Sorry, to clarify what is shown above, I want to end it.

>

Please correct me if I am wrong but the easiest way I have ever done such a thing is:

  var group = []; (Var i = 0; i & lt; 50; i ++) for {var aGroup = {}; For (var j = 0; j & lt; 13; j ++) {aGroup.color [j] = color [j]; // color array aGroup.plant [j] = plant [j]; // Plant array aGroup.family [j] = family [j]; // Family array} group [i] = a group; // To add the group to the group at the end // You can do the following group [0] to use the color. AGroup.color [0]; // Not Checked   

Let me know if you get any problems.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -