filmov
tv
Static Properties & Namespaces | Object-Oriented PHP | Section-1 | Part-7

Показать описание
Beside having the usage in methods, the static keyword is also applicable for utilization with a class property. When a property or a method is defined with the static keyword, it needs to called or invoked using the actual PHP class name, otherwise the properties and the methods will be rendered to be inaccessible outside the class's scope. Once we use the class name directly followed by the scope resolution operator, we can then gain access to the public methods and properties. Likewise, a property, after being called statically, can then act like any other variable and hence can be assigned with a value. Along this new concept, we will explore few conceptual ideas about namespacing our class and looking at the output produced by our container method by inspecting the page elements.