CLASS & OBJECT in PHP
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
The basic concepts of Object-oriented programming concepts are:
- Class
- Object
- Inheritance
- Constructor
- Destructor
- Polymorphism
CLASS
A class is a template which represents a real-world entity, and it defines properties and methods of the entity. It is only structure of operations , it comes in action when object is being created
You could think of class properties as variables that are used to hold information about the object.
Object
Objects are an instance of a class. A variable holds the data of a class. You must define a class once and subsequently create as many objects as needed in it.Objects are defined from classes in Object-Oriented Programming like PHP. When a class is defined, we can create many objects out of the class.
example :-
$parrot = new Fun();
$pigeon = new Fun();
$woodpecker = new Fun();