title: Dynamically call Class with variable number of parameters in the constructor
body: <p>I know that it is possible to call a function with a variable number of parameters with call_user_func_array() found here -> <a href="http://php.net/manual/en/function.call-user-func-array.php" rel="noreferrer">http://php.net/manual/en/function.call-user-func-array.php</a> . What I want to do is nearly identical, but instead of a function, I want to call a PHP class with a variable number of parameters in it's constructor.</p>
  
  <p>It would work something like the below, but I won't know the number of parameters, so I won't know how to instantiate the class.</p>
  
  <blockquote>
  <pre><code>&lt;?php
  //The class name will be pulled dynamically from another source
  $myClass = '\Some\Dynamically\Generated\Class';
  //The parameters will also be pulled from another source, for simplicity I
  //have used two parameters. There could be 0, 1, 2, N, ... parameters
  $myParameters = array ('dynamicparam1', 'dynamicparam2');
  //The instantiated class needs to be called with 0, 1, 2, N, ... parameters
  //not just two parameters.
  $myClassInstance = new $myClass($myParameters[0], $myParameters[1]);
  </code></pre>
  </blockquote>