Here\'s what I want to do:
$clsName = substr(md5(rand()),0,10); //generate a random name
$cls = new $clsName(); //create a new instance
function __autoload(
function __autoload($class) {
$code = "class $class {`
public function run() {
echo '$class
';
}
".'
public function __call($name,$args) {
$args=implode(",",$args);
echo "$name ($args)
";
}
}';
eval($code);
}
$app=new Klasse();
$app->run();
$app->HelloWorld();
This might help to create a class at runtime. It also creates a methor run and a catchall method for unknown methods But better create Objects at runtime, not classes.