PHP: Is it programatically possible to append iterator value to array key name in loop? -


I have a multi-dimensional array item, and in a loop, I want to add an iterator to the key and get the value I am Sample code for display:

  $ array_object-> example1 = 1; $ Array_object- & gt; Example 2 = 2; $ I = 1; Whereas ($ i & lt; = 2) {echo ($ array_object-> Example: $ I); // This does not work // How to complete? $ I ++}  

Thanks in advance for any suggestions.

I think your problem will be solved immediately:

  $ Example = "example" $ I; Echo $ array_object- & gt; $ Example;  

But you can $ array_object-> The example can be used to create an array and consider accessing it like this:

  resonates $ array_object-> Example [$ i];  

Comments