Self As Attribute

By Jan Nedbal

../_images/self-as-attribute.png

Self, parent and static cannot be used as attributes. They are not recognized, and PHP will search for a class called \self instead, in vain.

On the other hand, it is possible to use an attribute onto its own methods, simply by using its regular name.

It is possible to use these names as attributes, as long as they are not instantiated.

It is also possible to use aliases with the attributes: they will automatically resolve to the original class, not the aliased name.

See Also

PHP Features