What is the abstraction in PHP?

Abstraction is the concept of moving the focus from the details and concrete implementation of things, to the types of things (i.e. classes), the operations available (i.e. methods), etc class A { private $isOn = false; public function on() { $this->isOn = true; } public function Off() { $this->isOn = …

Read More »

What is the encapsulation in PHP?

Wrapping some data in single unit is called Encapsulation. Encapsulation is used to safe data or information in an object from other it means encapsulation is mainly used for protection purpose. class A { private $name; public function setName($name) { $this->name = $name; } public function getName($name) { return $this->name; …

Read More »

What is the Polymorphism in PHP?

Polymorphism is one of the PHP Object Oriented Programming (OOP) features. Polymorphism is derived from two Greek words. Poly (meaning many) and morph (meaning forms). In general, polymorphism means the ability to have many forms. In other words, “Polymorphism describes a pattern in Object Oriented Programming in which a class …

Read More »

What is the inheritance in PHP?

Inheritance is the process in which object of one class acquire the properties of another class. The following types of inheritance is supported in php- Single Level Inheritance – In Single Level the Parent class methods will be extended by the child class. All the methods can be inherited. class …

Read More »

What is the visibility in PHP?

Each method and property has its visibility. There are three types of visibility in PHP. They are declared by keywords public, protected and private. Each one of them controls how a method/property can be accessed by outsiders. The details are given below- Public: It allows to access its method/property from outside. This is the …

Read More »

What is the Getters and Setters in PHP?

“Getters” and “Setters” are object methods that allow you to control access to a certain class variables / properties. A “getter” allows to you to retrieve or “get” a given property. A “setter” allows you to “set” the value of a given property. class A { /* Member variables */ var $name; …

Read More »

What is the Abstract class in PHP?

Abstract classes are the classes in which at least one method is abstract. All base classes implementing this class should give implementation of abstract methods declared in parent class. An abstract class can contain abstract as well as non abstract methods. // Abstract class abstract class A { // This is …

Read More »