Course Banner



‘Small talk’ was the first oop language

Java was the first popular Object oriented programing language

C++, java and c# are some of The popular programing languages

Object oriented feature came in php after version 5

OOPS Concept

Any programing language is said to be an OOPs( Object Oriented Programing System) programing language if it has following basic features:

  1. Classes: A group of object which have common properties and behaviour, is called class.
  2. Objects : Object is an example of class.
  3. Abstraction : Highlighting essential features is called Abstraction.
  4. Encapsulation: Hiding unnecessary details is said to be encapsulation. Abstraction is implemented through encapsulation
  5. Inheritance : The feature, in which base class inherits the feature of child class, is called inheritance.
  6. Polymorphism : When same entity behaves differently in different situation, is called polymorphism.

Understanding OOps



Abstraction is the mechanism in which only the essential features are highlighted and unnecessary detail are hidden from users. For example, in a car the users are provided gear, accelerator, steering wheel etc . User does not need to know how the engine works . How the petrol is converted into electric etc. In programing world, software developer provides the user the user interface to handle the system. User need not know how the coding was done to work the system.



Encapsulate, to hide unnecessary details. For example In a capsule, the patient need not know what is inside the capsule. The patient sees the shinny capsule and does not know the bitter medicine which has been encapsulated.

In software world, database connection, security related code is encapsulated from the users so that it cannot be tempered with.



Take example of India women. She takes cares of he household work, she takes care of cooking, she takes care of children, she takes care of her office going husband. Etc. She is a single person but does different work as per situation

In Software world, when function name is same for but performs different task as per parameter, its called method overloading or polymorphism.



The process in which the child class inherits the data member of base class, its called inheritance.



When you think about a car, you think about whole general car. The car have some attributes and performs task. Its small whecile, its private man carrying whecile, it has four wheels, steering wheel etc. And it can run and honk etc.

So, all the cars having the above said common features will come under car class. So, class is a group of object which has common properties and behaviour(functions).

PHP Class Object


So, the car class Wireframe Model does not exist physically. Its just imaginary. This is just prototype.




What is a Class?

A group of objects which have common properties and behaviour, is called class.


So, lets get back to practical PHP world and write a simple code for a class.

Class Car{
	$color=‘Red’ // Example of properties
	$design:string=‘New’ // Example of properties

	public function run(){ // This is example of behaviour(Work)
		echo  ‘Car can run’;

What is an Object?

Object is an instance/example of class. Object is physical and we can touch it and work with it.



To run the car , the car must exists. We cannot drive with wireframe paper model car. Similarly, to access properties and methods of the class, we must create object first, only then we can access its behaviour.

Class Car{
	$color=‘Red’ // Example of properties
	$design=‘New’ // Example of properties

	public function run(){ // This is example of behaviour(Work)
		echo ‘Car can run’;

Here we have created one object of car Class. So, we can access now properties and methods of car class.

echo obj.color;


The above properties and methods we can access through its object.

What is constructor?

Constructor is a special function which is automatically called when the object is created. To access other functions we have to create object first and then we can access the function specifically. But constructor can be called as soon as you create object.

PHP Class Inheritance



All Cars Inherits from same car Class but some cars have different design and additional functionalities.


For Example, BMW’s car inherits all features of a normal car but its design is different from normal car and also it have AI features. For example, automatic break, finger touch door open etc.

Types of inheritance

  1. Single Inheritance
  2. Multiple Inheritance
  3. Multi-Level Inheritance

Single Inheritance


Multiple Inheritance


Multi-Level Inheritance


PHP Static Keyword

When data member of any class is declared static, no object is needed to create to access these data members.Points to remember :

  1. In Java and C# there is concept of static class.
  2. In C# , Java static class cannot be inherited.
  3. The difference between Static and Variable is that the variable data is overwritten during program execution while if the data member is Static, it holds the previous values during program execution.
  4. To access static data member, you don’t need to create object of he class, you can directly access these data members using Class Name.

PHP Access Specifier

There are different level of data member accessing rules. So, with this example, I will try to explain how that works.


At airport of railway station, any user can use the WIFI. That means the wifi can be accessed by anyone.


All the family members can access the wifi in any certain room. So, in this scenario, we can say, the Home Wifi has ‘Protected Access’


Your mobile can access internet only within your mobile and not outside.
So, in this scenario, we can say this is ‘’ Private Access”.


Method Overriding

When base class and child class have same function name then child class overrides base class function and displays the child class function. This activity is called method overriding.

Method Overloading

When function’s name is same but their signature(parameters) is different then its called method Overloading.

When same function performs different task based on parameters, can be termed as function overloading.


Software Used

  1. Xampp with latest PHP 7
  2. Bootsrap


  1. Knowledge of Core PHP.
  2. Basic knowledge of CSS and Bootstrap.

Whom is this tutorial for?

  1. Who has basic knowledge of PHP.
  2. Wants to learn Advanced Object-Oriented CRUD Operation.

Steps to be followed

  1. Create Database
  2. Create table
  3. Insert Form
  4. View List
  5. Edit page
  6. Update Page
  7. Delete Page