PHP Classes

File: OOP-PHP/readme.md

Recommend this page to a friend!
  Classes of Kabir Hossain   Learn PHP   OOP-PHP/readme.md   Download  
File: OOP-PHP/readme.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Learn PHP
Examples of PHP features using OOP or global code
Author: By
Last change:
Date: 5 days ago
Size: 1,754 bytes
 

 

Contents

Class file image Download
OOP Concepts in PHP:

     Object-oriented programming: Object-oriented programming (OOP) is a programming model that uses objects and their 
     interactions to design a computer programs.
 
     Objects: Objects are basic building blocks of a PHP OOP program. An object is a combination of data and methods. 
     In a OOP program, we create objects. These objects communicate together through methods. 
     Each object can receive messages, send messages, and process data.
 
     There are two steps in creating an object.
     
     Class : A class is a template for an object. It is a blueprint which describes the state and behavior that the objects of the class all share. 
     A class can be used to create many objects. 
     Objects created at runtime from a class are called instances of that particular class. 
     
     The basic programming concepts in OOP are:
         1. Abstraction: Abstraction is hiding the information or providing only necessary details to the client.
            Abstraction means hidden or abstracted implementation details. We use interface or abstract class for this.
         2. Polymorphism: The process of using an operator or function in different ways for different data input.
         3. Encapsulation: Wraping up member variables and member functions together into a single unit(ie.Class);
         4. Inheritance: When a class acquire the property of another class is known as inheritance.
 
    Polymorphism can be achived by two ways:
      1. Method Overloading: Multiple methods with same name but different parameters in a class.
      2. Method Overriding: Creating same method to child class.