Wednesday, October 10, 2007

Simple PHP Class Example Part 1

$item = new Items;
$item -> setName("Book");
$book = $item->getName();

$item -> setName("Pencil");
$Pencil = $item->getName();

class Items
{
var $item;

function setName($newname)
{
$this->title=$newname;
}

function getName()
{
return $this->title;
}
}

No comments: