[PHP] new $foo->className(); Class name must be a valid object or a string

[PHP] new $foo->className(); Class name must be a valid object or a string

Post by heavyccase » Mon, 05 May 2008 09:59:55



Does...
<?php
$bar = new $foo->className()();
?>
...work?

Otherwise, I'd just do...
<?php
$className = $foo->className();
$bar = new $className;
?>
...instead of $tmp.