title: Dynamically passing correct number of parameters to class constructor
body: <p>I do this here:</p>
  
  <pre><code>public function fetch($className) 
  { 
     $rows = array();
     while($r = $this-&gt;result-&gt;fetch_object() { 
        $rows[] = new $className($r);
     }
     return $rows;
  }
  </code></pre>
  
  <p>Constructor</p>
  
  <pre><code>class User
  {
     public $dbh;
     public $row; 
     public function __construct($dbh, $row = null) 
     {
        $this-&gt;dbh = $dbh;
        $this-&gt;row = $row;
     }
     public function getAll()
     { 
        return $this-&gt;dbh-&gt;query('SELECT * FROM users')-&gt;fetchAll();
     }
     public function getFirstName()
     {
        return $this-&gt;row-&gt;first_name;
     }
  }
  </code></pre>
  
  <p>This is all good and well if my class constructor only has ONE parameter.</p>
  
  <p>How do I make this dynamic so that I can have other parameters in my constructor. Hope this makes sense.</p>
  
  <p>Any help would be awesome :-)</p>