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

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

 



	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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[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