PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hmm.. what I suspect is that you should be using objects to represent these data-types, but that's more theory.
I think the way to do this is brute-force search it. Do a foreach() loop on the outer array and then another foreach() loop on the inner array: the indices will tell you where it is.
As for the second question, I'm not sure what you mean. $array[0][1] = "2" should do the trick.
Ambush Commander wrote:Hmm.. what I suspect is that you should be using objects to represent these data-types, but that's more theory.
I think the way to do this is brute-force search it. Do a foreach() loop on the outer array and then another foreach() loop on the inner array: the indices will tell you where it is.
As for the second question, I'm not sure what you mean. $array[0][1] = "2" should do the trick.
What do you mean by using objects to represent these data-types?
Objects, defined as a class construct whereby it may have one or more instance variables, sometimes called properties (or data members), and one or more functions, called methods.
There is a potential for two classes here. One for the individual data elements (the stored arrays) and one for the outer array providing functionality like searching for something in the contents.