Skip to content


PHP OOP - Constructor

Complete Tutorials of PHP OOP Constructor with Example code

Constructor in PHP is special type of function of a class which is automatically executed as any object of that class is created or instantiated.

PHP – The __construct Function

PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.

Read More »Complete Tutorials of PHP OOP Constructor with Example code

Classes And Objects

PHP OOP – Classes And Objects

  • by

A class is a template for objects, and an object is an instance of class.

Object Oriented Concepts

Before we go in detail, lets define important terms related to Object Oriented Programming.

  • Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.
  • Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.

Read More »PHP OOP – Classes And Objects