Instantiate by var name
Posted: Sun Jun 19, 2005 12:53 pm
If I have a string, for example $str = "Class"; How can I cause $obj to be the result of new Class()?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$class = "ClassName";
$obj = new $class( $arg[0], $arg[1], ... );