So I want to do something开发者_如何学C like this:
$ob = new $this->other_class_name;
but it fails. How can I do it without storing other_class_name in local variable?
Save the name in another variable:
$class = $this->other_class_name;
$ob = new $class;
Try this:
$class = get_class($this->other_class_name);
$ob = new $class;
精彩评论