Learn PHP Tutorial

PHP – What is OOP

Object-oriented programming, commonly referred to as OOP, is an approach to software development that helps you to develop complex applications around real world objects such as cars, employee, bank accounts etc.

Using object-oriented programming, you interact with your application by using objects. Whereas with procedural programming, you have to primarily interact with functions and global variables.

Object-oriented programming concept firstly added to PHP5. After addition OOP to PHP, it helps developer to build reusable and complex web applications. The main power of object oriented programming comes from the concept of inheritance and polymorphism.

OOP concept programming methodology:

  1. Code more modular and reusable
  2. Well organized code.
  3. Easier to debug and maintenance
  4. Best for medium to large complex web application projects

In OOP, there is a concept of class and object.

A Class defines the properties and methods of a real world object. It is a template for creating similar kind of instances of the same type of object.

An Object is an individual instance of the data structure defined by a class. It is an instance of a class.

Object Oriented Programming Concepts

  • Class and Objects
  • Encapsulation
  • Access Modifiers
  • Constructor and Destructor
  • Inheritance and its types
  • Abstract Class and Methods
  • PHP Interfaces
  • Polymorphism
  • Overloading