To solve the problem, you need to be able to pass an arbitrary number of arguments to a function.
func_get_args() does the trick, in combination with some really dirty hacking, i.e. we use eval()
Here's what you can do:
function Myclass() {
$name="Myclass".func_num_args();
// put the arguments in an array
$args = func_get_args();
// convert the array into a string,
// using the ',' as separator
$tempcode = implode("','", $args);
$args = "'".$tempcode."'";
// prepare a new string
$string = "\$this -> \$name($args);";
// treat the entire string as PHP code
eval ($string);
}
This should do the trick.
Oh, and by the way: never ever use eval() yourself. It's an evil function and it's invocation could easily send you to deepest pits of Hell.
Have fun!
Onno.