Re: Extending a class with a static constructur (like PEAR::DB)

From: Date: Thu, 09 Mar 2006 23:56:21 +0000
Subject: Re: Extending a class with a static constructur (like PEAR::DB)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-231742@lists.php.net to get a copy of this message
Weston wrote: > > $dte = DBToyExt::connect("mysql://weston_tssa:******@localhost/weston_tssa"); > > > > $dte->testext('testing'); > > $dte->testext($dte->moo); > > $dte->testext($dte->bar); On Fri, Mar 10, 2006 at 10:43:02AM +1100, Chris wrote: > $dte will only have the return value of DBToyExt::connect() - it won't > allow you to access other methods in the class. > > You'll need to: > > $dbtoy = new DBToyExt(); > $dbtoy->connect(....) > $dbtoy->testext('testing'); Thanks! Works like a charm: http://weston.canncentral.org/web_lab/mlib/DBToyExt2.php That's interesting. I think I just sortof expected that since the canonical invocation is through a statically called method, calling it by dereferencing a specific object wouldn't work. Does anyone know if that would also work in PHP 5? If not, is there another way to do what I'm trying to do? Thanks, Weston

« previous php.general (#231742) next »