suleman dot saleh at gmail dot com (26-Oct-2010 02:41)
Using php abstract classes we must have to implement all their functions in child classes other wise it will make automatically child class as a concrete
DavMe (01-Oct-2010 03:03)
When you have a class name in a variable and want to create a new instance of that class, you can simply use: <?php
$className = "ClassName"; $instance = new $className(); ?>
If, however, you have a class that is part of a singleton pattern where you cannot create it with new and need to use: <?php
$instance = ClassName::GetInstance(); ?>
...you quickly discover that it fails miserably with a variable.
Fail Example: <?php
$className = "ClassName"; $instance = $className::GetInstance(); ?>
After a few days of head pounding, I finally put together this workaround: <?php
$className = "ClassName";
eval('$instance = '.$className