title: How to create new php objects within a loop?
body: <p>I've got an array with some php class names (e.g. ClassOne.php)</p>
  
  <pre class="lang-php prettyprint-override"><code>classes = [ 'ClassOne' ,  'ClassTwo' ,  'ClassTree' ];
  </code></pre>
  
  <p>I want to write a loop that creates a new object for each of the class names. Without a loop, it looks like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>$class1 = new ClassOne;
  $class2 = new ClassTwo;
  $class3 = new ClassTree;
  </code></pre>
  
  <p>After that object creation I want to check if $class1,2,3, ... is a instance of the main class (Components)</p>
  
  <p>Is it possible to store the new objects in a array that can get iterated like this?</p>
  
  <pre class="lang-php prettyprint-override"><code>    $classes = [ $classs1, $class2, $class3 ];
      foreach($classes as $class)
      {
          if (is_object($class) &amp;&amp; $class instanceof Component)
          {
               echo 'is an instance of Components';
          }
      }
  </code></pre>