Code
<?php
//object not encapsulated with a class
class test_object
{
public $var1 = " <font style='color:red;'>
object oriented programming</font>";
public $required = array('age', 'name', 'comments');
function test_object()
{
echo "<br/><font style='color:Green;'>
constructor evoked</font>";
}
function _construct()
{
echo "<br/><font style='color:red;'>
function responded OK<font>";
}
}
echo 'This prints nothing'. $var1;
echo '<br/>Creating instance of a class';
$obj1= new test_object();
$obj3= new test_object();
echo '<br/> Instance Created';
echo '<br/>Public Object : $obj1->$var1';
$obj2 = $obj1->var1;
echo "<br/>public variable $obj2";
echo '<br/> Calling a function $obj1->_construct()';
$obj1->_construct();
?>
