Re: How can I do this -- method chaining

From: Date: Wed, 30 Jan 2008 16:46:28 +0000
Subject: Re: How can I do this -- method chaining
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-268340@lists.php.net to get a copy of this message
On Jan 30, 2008 11:31 AM, Stut <stuttle@gmail.com> 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

« previous php.general (#268340) next »