Destructors are inverse of Constructors in Object Oriented Programming. They are automatically called when an object is no longer in scope. In this article, we will discuss about PHP Destructors. If you are new to Object Oriented Programming in PHP, you should first read the Introduction article. Class Destructors A destructor is a special method… Read more PHP Destructors | Destroy a Class Object
Category: PHP Object Oriented Programming
PHP Interface | Object Oriented Concepts
An Interface in PHP allows you to create methods which a class must implement, without giving any details about its implementation. They resemble abstract methods in an abstract class. However, unlike Abstract Classes you don’t need to provide the implementation of methods in an Interface. In this article, we will discuss PHP Interfaces along with… Read more PHP Interface | Object Oriented Concepts
Abstract Classes in PHP | Object Oriented Concepts
A Child Class can inherit properties from a Parent Class. Also, you can directly create an object of a Parent Class. However, you can’t instantiate an object of an Abstract Class directly. In this article, we will discuss Abstract Classes in PHP. Also, we will discuss their implementation along with a few examples. You might… Read more Abstract Classes in PHP | Object Oriented Concepts
Final Keyword in PHP | Object Oriented Concepts
A class can inherit properties from a parent class. However, it can only inherit public and protected properties. Also, the child class can override methods of the parent class. PHP introduces the Final Keyword, which prevents the child class from overriding methods of the parent class by prefixing it with Final Keyword. Additionally, no other… Read more Final Keyword in PHP | Object Oriented Concepts
Class Constants in PHP | Object Oriented Concepts
Constants are a bit different than regular variables in PHP. Class Constants are immutable properties. Therefore, you cannot change the value after defining it for the first time. In this article, we will discuss Class Constants in PHP. What are Class Constants in PHP? It is possible to define Class Constants in PHP. A constant… Read more Class Constants in PHP | Object Oriented Concepts
Function Overriding | Object Oriented Concepts in PHP
We discussed Inheritance in PHP in an earlier post. We learned that a Child Class can inherit the properties of a Parent Class. Function Overriding allows the Child Class to have the same method which already exists in the Parent Class. By overriding the method we can modify the definition of a function inherited from… Read more Function Overriding | Object Oriented Concepts in PHP
Inheritance | Object Oriented Concepts in PHP
Inheritance is one of the most important concepts of Object-Oriented Programming. It allows a class to inherit some properties of another class. It comes very useful when we want to build a class upon an existing class. In this article, we will discuss Inheritance in PHP. If you are new to Object-Oriented Programming, then I… Read more Inheritance | Object Oriented Concepts in PHP
Constructors | Object Oriented Programming in PHP
In my previous post on Object-Oriented Programming, we learned about Access Modifiers. Let’s take the discussion forward to some advanced concepts. In this article, we will discuss Constructors. If you are new to Object Oriented Programming, please read my beginner post on it first. Class Constructors A constructor is a special method in a Class… Read more Constructors | Object Oriented Programming in PHP
Static Keyword | Object Oriented Programming in PHP
We discussed public and private Access Modifiers earlier. Sometimes, we require access to a Class’s members without creating an object. In this situation, we use Static Keyword in PHP. Defining a class property static makes it accessible without instantiating an object of the class. In this article, we will discuss the use of Static Keyword… Read more Static Keyword | Object Oriented Programming in PHP
Access Modifiers | Object Oriented Programming in PHP
In the previous post, we introduced Object Oriented Programming in PHP. We discussed the difference between Class and Object. Also, we learned to create a basic Class in PHP. In this article, we will discuss Access Modifiers. If you are new to Object Oriented Programming, I would recommend you to go through my first article… Read more Access Modifiers | Object Oriented Programming in PHP