'Is PHP instantiation by class string name an example of reflection?
For example, in PHP you can do something like this
$className = 'MyClassName';
$instance = new $className();
Would this be considered an example of reflection in php and/or other languages that support similar mechanisms? Or would the meaning of reflection be reserved for something like the below.
$otherInstance = new MyClass();
$className = get_class($otherInstance); #this line would be reflection
$instance = new $className(); #but this wouldn't?
In addition, would instantiation through the usage of for example ReflectionClass::newInstance be different in these cases and be considered a use of reflection or not?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
