Static Properties – PHP OOP

Static Properties in PHP You can call static properties directly, without making a new instance of a class. The static keyword is used to declare properties that don\'t change: Syntax…

Static Methods – PHP OOP

Static Methods in PHP You can call static methods directly, without first making an instance of the class. The static keyword is used to declare a static method: Syntax <?php…

Traits PHP OOP

What are Traits in PHP? PHP only allows one type of inheritance, so a child class can only get its traits from one parent class. So, what happens if a…

Interfaces in PHP OOP

How do Interfaces work in PHP? Interfaces let you tell a class what methods it should have. Interfaces make it easy for different classes to be used in the same…

Abstract Classes – PHP OOP

What are Abstract Classes and Abstract Methods in PHP? Abstract classes and methods are used when the parent class has a named method, but the task needs to be done…

Inheritance PHP OOP

What does inheritance mean in PHP? In OOP, inheritance is when a class is based on another class. All of the public and protected properties and methods of the parent…

Class Constants – PHP OOP

Class Constants in PHP Once a constant is declared, it can\'t be changed. If you need to define some data that stays the same inside a class, you can use…

Access Modifiers – PHP OOP

Access Modifiers in PHP Access modifiers can be put on properties and methods to control how and where they can be used. There are three things that change access: public:…

Constructor / Destructor – PHP OOP

The __construct Function in PHP A constructor lets you set up an object\'s properties when you first create it. If you make a __construct() function, PHP will automatically call it…

Classes and Objects – PHP OOP

A class is a template for objects, and an instance of a class is an object. OOP Case Let\'s say our class is called Student. A Student can have a…