Re: How to call a static class and method dynamically
| From: | Josip Dzolonga | Date: | Mon, 04 Apr 2005 12:02:41 +0000 |
| Subject: | Re: How to call a static class and method dynamically | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-212161@lists.php.net to get a copy of this message | ||
Dan Rossi wrote:
I was wonderiing how I would go about something like this $class = 'classname'; return $class::staticMethod(); , not happy isnt working. Any ideas lemme know. class MyClass {function static_method() {
echo 'I'm in static_method !';} } You can call the function statically using the double colon ( :: ) operator : MyClass::static_method(); I suggest you to take a good look here http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com