PHP Encapsulation - how to develop a website -

PHP Encapsulation

Best PHP Training with Live Project in Noida Fee is only 7500/-Click here for FREE DEMO.


Encapsulation in PHP

Encapsulation is a concept of wrapping up or binding up related data members and methods

in a single module known as encapsulation

And hiding the essential internal property of that module known as data abstraction.

welcome Pankaj
You are 5 years old

Create a arithmetic class with add( ),sub( ),mult( ) and div( ) method

Addition = 1500
Subtraction = 500
Multiplication = 500000
Division = 2

In the above example
Two properties $first and $second along with the methods add( ), sub( ), mult( ) and div( ) are defined in a single unit i.e in the class arithmetic.
We create the object of class arithmetic. that object called the methods and methods are performed their task with defined properties.

add( ) methods perform addition of two properties $first and $second.
sub( ) methods perform subtraction of two properties $first and $second.
mult( ) methods perform multiplication of two properties $first and $second.
div( ) methods perform division of two properties $first and $second.

Keep Updating yourself