0% found this document useful (0 votes)
3 views

php-2

The document outlines a PHP script for defining a Rectangle class with methods to calculate the area and perimeter. It includes a constructor to initialize length and breadth, and a destructor to handle object destruction. The script demonstrates object-oriented programming principles in PHP.

Uploaded by

cshivanand628
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

php-2

The document outlines a PHP script for defining a Rectangle class with methods to calculate the area and perimeter. It includes a constructor to initialize length and breadth, and a destructor to handle object destruction. The script demonstrates object-oriented programming principles in PHP.

Uploaded by

cshivanand628
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

script as and

breadth
area()
tie
UI and
define
enU
length
le Also
with rectangle.
class.
Rectangle
the
a
for of
perimeter
destructor
class
a
define
and
and
area
toconstructor function
Rectangle
($1,$b)
JITATIcally.
scriptdisplay
PHP
to $this->l=
functions
a Define class
Rectangle
Write
members.
1.3: erimeter()
ogram <?php
ta {
Output: Advance
Perimeter initialized ?>
is $r->area();
Object$r->perimeter $b=5.4;
$1=3.2;
estroyed.
Object
In is AreaLength (); $r=new
above function
{ { function
area() PHP
of perimeter()
function
rectangle 3.2, = Rectangle echo
$p=2*($this->l+$this->b) ; echo
echo $a=$this->l*$this->b; $this->b=$b;
echo echo (BBA-
PHP of
ript, rectangle Breadth "<br>Object "<br>Perimeter "<br>Area "<br> "<br> CA:
destruct()
= ($1, Sem.
the 17.28 LengthObject
= =5,4 $b) IV)
ent 17.2 of
; is rectangle = is
destroyed";
//destructor
definition of $this->l, 1.8
is rectangle initialized";
new
gle
=$a";
Breadth= Introduction
=$p";

$b) $this->b"; to
r Programmlng
Oriented
Object
f
a
okes
the
r Constr

You might also like