Re: How can I do this -- method chaining

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

 



On Jan 30, 2008 11:31 AM, Stut <stuttle@xxxxxxxxx> wrote:

>
> "I would *just* use a static method"
>
> *just* *just* *just* *just* *just* *just* *just* *just* *just*
>
> No instance. None. Grrr.


here is a mod of the code you posted w/ a var_dump() of the
local variable $o;

<?php
class Test {
    public static function doSomething() {
        $o = new Test();
        var_dump($o);
        $o->_doSomething();
    }

    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();
?>

nathan@gentooss ~/ticketsDbCode $ php testCode.php
object(Test)#1 (0) {
}


clearly in the act of *just* using a static method, you *just*
created an instance of class Test ;)

-nathan

[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