title: passing php object into array/list like in java
body: <p>maybe its duplicate but i cant find it.</p>
  
  <pre><code>    something = new ArrayList&lt;&gt;(); 
  something.add(new Object("Hello"));
  something.add(new object("World"));
  something.add(new Object("!"));
  for(blablabla){
  System.out.print(something.get(i).getTextFromConstructor());
  }
  </code></pre>
  
  <p>this will print "Hello World!"</p>
  
  <p>in php i dont know solution to pass whole objects into array to call their methods from loop or just by something[0]->method();
  As  i know this in php cannnot be done, but maybe i am wrong :-)</p>
  
  <p>Thank You</p>