How to create new instance of a class from get method

There is a very simple script that does the job

$className=$_GET['classname']; // coming from url

function get($className)
{
if(!isset($instance))
{
include($className.”.class.php”); // include the class file
return $instance=& new $className();
}
}

print_r(get($className));

Explore posts in the same categories: PHP

Comment: