PHP class name from variable with "class not found" check?
I'm trying to implement the strategy pattern in PHP, creating objects with variable variables as follows:
$className = 'MyClass';
$myObject = new $className();
Is there a way to verify that $cla开发者_如何转开发ssName exists as a Class?
class_exists($className)
精彩评论