You are here: Re: Current class name for use with :: « PHP Programming Language « IT news, forums, messages
Re: Current class name for use with ::

Posted by Ciaran on 05/03/06 17:20

Andy,

I think that 'self' will not do what you want, in this instance.

In PHP, 'self' always refers to the class in which it is used so in
your example code you will get a warning that A::TEST_CONST is not
defined when you try either $b->printConst() or $c->printConst().

This is very annoying behaviour, but there isn't a keyword in PHP5 that
refers to 'the current class' in the way you want it to. This is under
discussion for PHP6, and a new keyword apparently may or may not be
introduced - I'm hoping very much that it will!

See:
http://www.php.net/~derick/meeting-notes.html#late-static-binding-using-this-without-or-perhaps-with-a-different-name

 

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

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