Re: Class not used as an object (Scope Resolution Operator)

From: Date: Tue, 14 Jun 2011 05:52:00 +0000
Subject: Re: Class not used as an object (Scope Resolution Operator)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-313509@lists.php.net to get a copy of this message
Thanks all. Assuming is best then to add the static in this case. But it isn't required if I birthed an object first and referenced the object, correct? Am wanting to add some variables to the class so not calling the same query so many times... Thanks again. George On 2011-06-09, at 5:23 PM, David Harkness wrote: > All of the above with a clarification: they are instance methods which you > are calling statically. The object is not instantiated in this case. PHP > allows this but will issue an E_STRICT warning. To remove the warning just > add "static" before each of them, assuming they are only ever called > statically: > > class myClass { > static function &doThis($passedVar) { > doSomething; > } > > static function &doThat($anotherVar) { > doSomethingElse; > } > } > > David

« previous php.general (#313509) next »