Hi all. Am fixing some inherited code, and the previous coder created a
class, ie:
class myClass {
function &doThis($passedVar) {
doSomething;
}
function &doThat($anotherVar) {
doSomethingElse;
}
}
BUT, I don't see anywhere where he created an object, ie:
$myObject = new myClass();
or
$myObject = myClass::doThis("value");
Instead, it's only ever just called directly with a "Scope Resolution
Operator", ie:
myClass::doThis("valueOne");
myClass::doThat($whatever);
myClass::doThis("valueTwo");
myClass::doThat($andSoOn);
It seems that this would be making an object, and then destroying it
again, on each of the four calls above, which I would think would be wasteful -
time, memory, cpu usage, etc.
The class has no constants or variables (properties) for any need for
persistence, and is just a collection of functions (methods), so I don't see a
reason to group them into a class - they could all reside as independent
functions within the php file.
Is this good? Is there some advantage to making a non-persistent class?
Thanks!
George Langley Multimedia Developer Audio/Video Editor Musician,
Arranger, Composer