Let's say I have the following class:
class Test
{
function __construct()
{
$this->run();
}
function run()
{
$this->handle();
}
function handle()
{
}
}
Normally I would create an instance like:
$test = new Test();
However, I really do not need $testanywhere, since the functions in the class do all the work once and after that I will no longer need an instance of the class.
What should I do in this situation or should I only do: $test = new Test();
I hope that what I try to say, if not, please, makes sense.
source
share