Why to learn Object-oriented PHP ?

Why to learn Object-oriented PHP ? Before moving further we should must know what i am going to learn and why it is useful to learn ? Object Oriented programming(OOP) gives us code re-usability feature. It means write a code and use it where you need it. Lets take a scenario to understand how OOPS is helpful for code re-usability.

Continue reading

Class and objects in php

In this lesson you will learn : How to declare class How to add properties in the class How to create objects of a class How to add and retrieve properties from an object How to add methods to a class What is class ? In php a class is a collection of  properties and methods which handles certain topics

Continue reading

constructor and destructor in php

Discuss about last tutorial. Today we will learn about constructors and destructors. Before moving further we should know what are constructors and destructors ? Why we use constructor and destructor in php ? Constructor are the special method which gets initialized (called) just after object initialization (creation). Similarly, destructors are its vice-versa. Destructors are special method which is used to

Continue reading

$this keyword in php

What is $this in php ? $this keyword is used to approach to properties and methods within the class. You can achieve the properties and methods of the class using syntax.          SYNTAX $this->name; $this->fruitDetails(); $this keyword always starts with “$” sign while the approached property and methods does not contains ‘$’ sign as illustrated above. Let’s write

Continue reading

chaining methods and properties in php

In the previous lesson we learnt how to use $this keyword with the syntax and example. In this chapter we will learn making chain to methods and properties. We use this chain word in daily life. It is same as cycle chain. One block is connected to another block. Here method and properties chaining works same as it works in

Continue reading

Access Modifiers : Public vs Private

In the last chapter we discussed chaining methods and properties, and how to use them. Today we will learn an interesting topic which is Access Modifiers : public vs private.  From the starting of the tutorial we were using public access modifiers . The reason behind using the public access modifier is to use the public methods and property without any

Continue reading

Magic methods and constants in php

In the last lesson we discussed the access modifiers (public vs private) and their uses. Today we will learn about magic methods and constant in php. Why we call them magic method and magic constant and how to identify them. Since OOPS has several magic methods and magic constants which reduces the programming code. that is why it is referred as magic

Continue reading

Inheritance in php

In the last lesson we have learnt about Magic methods and constant . Today we will learn about inheritance. So let’s start with the question what is inheritance and their benefits and uses. By definition : In object oriented programming Inheritance is a concept which is used to achieve the public methods and properties from another class(i.e child class). Inheritance

Continue reading

abstraction in php

In the last lesson we have learnt abut one of the principle of Object Oriented Programming i.e Inheritance. Today we are going to learn about OOPs second principle i.e Abstraction. So let’s start with the meaning of abstraction. In general term abstraction means incomplete or something which is removed from original thing. In Object oriented concept, Abstraction provides a standard

Continue reading

interface in php

In the last lesson we learnt about abstract classes and today we will learn about an important topic of object oriented programming i.e Interface. Interface is similar to abstract classes while there are some difference in them. Declaration and implementation of Interface. Syntax :  we use keyword interface before the class name.

we use interface keyword before the class

Continue reading