<?php
include_once('singleton.class.php');
echo "<br /><b>In this example we tried to create different instance of the sTonClass <br />
But it every times returns the reference of the same instance . </b>";
echo "<br />----------------------------------------------------------<br />";
$sTonClassObject1 =sTonClass::inisiate();
$rs=array("Dog","Cat","Horse");
$sTonClassObject1->put('a',$rs);
echo "<pre>";
var_dump($sTonClassObject1);
echo "</pre>";
echo "----------------------------------------------------------<br />";
$sTonClassObject2 =sTonClass::inisiate();
$sTonClassObject2->put('b',71);
echo "<pre>";
var_dump($sTonClassObject2);
echo "</pre>";
$storedVariable1 = $sTonClassObject2->get('a');
echo "Using Get Method: <pre>";
print_r($storedVariable1);
echo "</pre>";
echo "----------------------------------------------------------<br />";
$sTonClassObject3 =sTonClass::inisiate();
$sTonClassObject3->put('a',81);
$sTonClassObject3->put('c',900);
echo "<pre>";
var_dump($sTonClassObject3);
echo "</pre>";
echo "----------------------------------------------------------<br />";
$sTonClassObject4 =sTonClass::inisiate();
$sTonClassObject4->invalidate('a');
$sTonClassObject4->put('a',500);
echo "<pre>";
var_dump($sTonClassObject4);
echo "</pre>";
?>
|