Reply to Re: $classname::a_static_func() won't work!!

Your name:

Reply:


Posted by Michael Winter on 08/29/05 14:59

On 29/08/2005 12:17, http://www.douglassdavis.com wrote:

[snip]

> A better question is, does any one know how to call a static function
> on a class that you only have the name of in a variable?

Use the function handling functions[1].

The first argument to the call_user_func function is the callback
pseudo-type. This means you can pass an array that specifies a method of
either a class or an instance (examples included in documentation of
callback type[2]).

You could use the class/object functions[3], such as get_class_vars, to
do a similar thing with members. However, only the class name is
necessary in this case, and the return value is an array of all public
members (static and otherwise).

Mike


[1] <URL:http://uk2.php.net/manual/en/ref.funchand.php>
[2]
<URL:http://uk2.php.net/manual/en/language.pseudo-types.php#language.types.callback>
[3] <URL:http://uk2.php.net/manual/en/ref.classobj.php>

--
Michael Winter
Prefix subject with [News] before replying by e-mail.

[Back to original 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

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