note 33520 added to function.call-user-func
| From: | ville dot tapio at fountainpark dot com | Date: | Sat, 28 Jun 2003 22:34:58 +0000 |
| Subject: | note 33520 added to function.call-user-func | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51157@lists.php.net to get a copy of this message | ||
I haven't figured out a good way to call static class methods without knowing the name of the
class.
This doesn't work:
Class Foo {
function bar() {}
}
$class = 'Foo';
$class::bar();
Ugly workaround:
Class Foo {
function bar() {}
}
$class = 'Foo';
eval ($class . '::bar();');
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33520
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33520&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33520&report=yes