I would like to call to a static method in such a way that class name and method name are variables.
Example:
class QQQ {
public function www($x) {
echo $x;
}
}
$q = 'QQQ';
$w = 'www';
$q::$w(7); // this is what I am trying to do but it throws an error.
Thoughts?
Just need to change
to
Because, you are calling it by scope resolution operator
::
so, it should be static OR you should change the way you are calling itShould work, depending on what you are trying to do with it.