hi saravanan here i have writen a simple program to create objects
The Box object to calculate the area of box PHP Code:
class Box
{
var width;
var height;
function setWidth(pmWidth)
{
$this->width = pmWidth;
}
function setHeight(pmHeight)
{
$this->height = pmHeight;
}
//This function now added to calculate the area of box object
function area()
{
return $this->width*$this->height;
}
}
$object = new Box; //The new key word used to create an object
$object->setWidth(100);
$object->setHeight(100);
print("Area of object box");
$object->area();
output
Area of object box :1000