You are here: Re: [PHP] How to call a static class and method dynamically « PHP « IT news, forums, messages
Re: [PHP] How to call a static class and method dynamically

Posted by Josip Dzolonga on 04/04/05 15:02

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация