Reflection
Reflection January 24th, 2009Reflection was introduced in PHP 5 to inspect and to retrieve information and reverse-engineer classes, interfaces, functions and methods as well as extensions during runtime.
Snippets:
How to create an instance of a class using reflection in PHP:
// this code does the same as: $instance = new ClassName();
$class = new ReflectionClass("ClassName");
if ($class->isInstantiable())
$instance = $class->newInstance();
Did you enjoy this tutorial? Be sure to subscribe to the our RSS feed not to miss our new tutorials!
... or make it popular on




Recent Comments