Hi,
I wonder, what are the pros and the cons of these two approaches to access variables:
1) CodeIgniter -style (does this have a name?)
public function doSomething()
{
$database = $this->database; // or just $this->database
}
2) The Singleton pattern
public function doSomething()
{
$database = Framework_Database::getInstance();
}
One obvious difference is that with Singleton, you can't modify it. You can only access it, but I'm talking about here only in the aspect of accessing an instance of a class or a variable.
Oh, and, are there other approaches?