Static properties in PHP
Static properties in PHP, can be used directly without creating class object. It can be used with class name only. Syntax Creating Static property static keyword is used before property/variable…
Static properties in PHP, can be used directly without creating class object. It can be used with class name only. Syntax Creating Static property static keyword is used before property/variable…
Static methods are the functions of a class, which are used directly without creating class object. Syntax static functions/methods are defined using static keyword then function keyword and functionname. Example…
Traits in PHP, allows to use or share its code in multiple classes without inheritance. Following are the features of using traits in PHP. Syntax Create a Trait Using a…
Namespaces in PHP, are used to group classes, interfaces etc under a given name, so that same names does not conflict with each other. By keeping same names under different…
Inheritance in PHP, is inheriting a class with another class, a class which is inherited called parent class and which inherits is called child class. In inheritance, child class uses…
In PHP, Interface acts as an agreement with implementing class, it must implement all its methods. Following are the features of PHP interfaces. Interface Usage When so many classes have…
In PHP, Abstract class cannot be instantiated (means object cannot be created), to use abstract class, other class must extend it and implement all its abstract methods. Abstract class can…
Access modifiers in class PHP, controls the accessibility(use) of its data members and member function. On this basis, a class in PHP has three access modifiers. public These properties or…
Destructor in PHP is used to deleted or remove object of class. It is automatically called by PHP when script is about to end. __destruct Function To add Destructor in…
Constructor in PHP, is a function which is called or invoked automatically when a class object is created. It is used to initialize data members while object creation. __construct Function…