Hi All,
I have been trying to dynamically call a static member function, as follows:
$className = 'MyClass';
$methodName = 'MyMethod'
$result = $className::$me thodName();
However, I get a parse error when I do this:
Parse error: parse error, unexpected T_PAAMAYIM_NEKU DOTAYIM in
/home/HE/web_develop/ghea/www/cgi-bin/lib/EventRegistrati onBridgerClasse s.inc
on line 28
Line 28 is indeed the line in which $result = $className::$me thodName();
appears.
Is there any way to do what I am trying to do? I have had success
dynamically calling methods on known classes. E.g.,
$methodName = 'MyMethod';
$result = MyClass::$metho dName();
This works fine. What if I want to have the class name dynamically defined
as well? Is there any way to do that?
Thanks for any pointers!
I have been trying to dynamically call a static member function, as follows:
$className = 'MyClass';
$methodName = 'MyMethod'
$result = $className::$me thodName();
However, I get a parse error when I do this:
Parse error: parse error, unexpected T_PAAMAYIM_NEKU DOTAYIM in
/home/HE/web_develop/ghea/www/cgi-bin/lib/EventRegistrati onBridgerClasse s.inc
on line 28
Line 28 is indeed the line in which $result = $className::$me thodName();
appears.
Is there any way to do what I am trying to do? I have had success
dynamically calling methods on known classes. E.g.,
$methodName = 'MyMethod';
$result = MyClass::$metho dName();
This works fine. What if I want to have the class name dynamically defined
as well? Is there any way to do that?
Thanks for any pointers!
Comment