Re: How can I do this -- method chaining

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

 



Jim Lucas wrote:
Stut wrote:
Nathan Nobbe wrote:
On Jan 30, 2008 10:53 AM, Stut <stuttle@xxxxxxxxx <mailto:stuttle@xxxxxxxxx>> wrote:

    Nathan Nobbe wrote:
    I never said I wasn't creating
    an instance in the example I posted.


then what exactly did you mean by this?

Actually no, I mean I would *just* use a static method. If there is no
reason to instantiate an object, why would you?

I meant "I would *just* use a static method". Calling a static method does not create an instance of the class. My comments usually follow the rule of Ronseal.

What do you think I meant by it?

-Stut


 From your previous email


<?php
class Test {
    public static function doSomething() {
        $o = new Test();

The above line IS creating a instance of the class Test

Now with proper garbage collection, it should be wiped out when you are done using the static doSomething() method.

        $o->_doSomething();

You could always include this to remove the instance of class Test

    unset($o);


    }

    protected function _doSomething() {
        // I'm assuming this method is fairly complex, and involves
        // more than just this method, otherwise there is no point
        // in creating an instance of the class, just use a static
        // method.
    }
}
Test::doSomething();
?>

"I would *just* use a static method"

*just* *just* *just* *just* *just* *just* *just* *just* *just*

No instance. None. Grrr.

FFS.

-Stut

--
http://stut.net/

--
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