Get Instance of class SingletonDemo into variable $foo

$foo = SingletonDemo::getInstance();

$foo->getVar() :: Expecting result => NULL

NULL

Set SingletonDemo to "buz"

$foo->setVar("buz")

$foo->getVar() :: Expecting result => string(3) "buz"

string(3) "buz"

Get Instance of class SingletonDemo into variable $foo

$bar = SingletonDemo::getInstance();

$bar->getVar() :: Expecting result => string(3) "buz"

string(3) "buz"

$foo->setVar("qar")

$foo->setVar("qar");

$bar->getVar() :: Expecting result => string(3) "qar"

string(3) "qar"

$foo->getVar() :: Expecting result => string(3) "qar"

string(3) "qar"

$bar->setVar("that's it")

$bar->setVar("that's it");

$bar->getVar() :: Expecting result => string(9) "that's it"

string(9) "that's it"

$foo->getVar() :: Expecting result => string(9) "that's it"

string(9) "that's it"