Suppose the following case:
class myClass
{
var $x = 1;
function doIt()
{
echo $this->x;
}
}
$myObject = new myClass
$myObject->doIt();//The integer 1 will be echoed.
/*What I want to happen is, on access myObject again, the value
which will be echoed must equals to 2 and so on */
$myObject->doIt()//The integer 2 will be echoed
What I mean, I like every time myObject is accessed by diIt() method,
the value of $x will be icreased by one.
Is this possible?
What are modifications, that I must do them on myClass to handle this?