Greetings Everyone,
In php it's possible to create a new object based on a name stored
in variable, i.e:
$className = "CSome$name ";
$newclass = new $className();
However is it possible to call a function from a class using a name
stored in a variable? For example:
$funcname = "operation" ;
$func= "\$someclas s->$funcname";
$func( arg1, arg2 );
With the same result as
$someclass->operation( arg1, arg2 );
Any feed-back will be much appreciated.
Cheers,
Roldao
In php it's possible to create a new object based on a name stored
in variable, i.e:
$className = "CSome$name ";
$newclass = new $className();
However is it possible to call a function from a class using a name
stored in a variable? For example:
$funcname = "operation" ;
$func= "\$someclas s->$funcname";
$func( arg1, arg2 );
With the same result as
$someclass->operation( arg1, arg2 );
Any feed-back will be much appreciated.
Cheers,
Roldao
Comment