How to dynamically call a constructor like call_user_func_array

From: Date: Thu, 27 Nov 2008 12:23:20 +0000
Subject: How to dynamically call a constructor like call_user_func_array
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-51171@lists.php.net to get a copy of this message
I want to create a new instance of a class (which name I don't know) and I want to expand a given array to be the constructor's parameters: class mycls { function __construct($var1, $var2) { } } $clsname = 'mycls'; $val = array('value1', 'value2'); $obj = new mycls($val[0], $val[1]); // This line needs to be dynamic. Couldn't find on the php site how to do this. Help would be appreciated!

« previous php.pear.dev (#51171) next »