The following is the sample program using classes and objects.
In this program, a class is created and its member variable is
assigned a value.
<?php
class test
{
var $a;
function assign($val)
{
$this->a = $val;
}
function display()
{
echo “Value ” . $this->a;
}
}
$t = new test();
$t->assign(‘2000′);
$t->a= 3000;
$t->display();
?>
The output of the above program will be:
Value: 3000