Class not used as an object (Scope Resolution Operator)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux