Reply to Re: [PHP] calling static methods of variable class names

Your name:

Reply:


Posted by David Grant on 11/22/05 15:44

Ahmed,

call_user_func(array($className, 'doSomething'));

Cheers,

David Grant

Ahmed Saad wrote:
> hi all,
>
> how can i call static methods of a class whose name is variable.. something like
> <? $className::doSomething(); // throws a parser error ?>
> I can do this with reflection by creating a ReflectionMethod object
> then invoke()ing it, but is there a better way?
> Thanks
>
> -ahmed

[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

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