Re: Method call improvements

From: Date: Tue, 12 May 2009 18:31:12 +0000
Subject: Re: Method call improvements
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-43914@lists.php.net to get a copy of this message
Hi Paul: On Tue, May 12, 2009 at 12:50:12PM +0100, Paul Biggar wrote: > > This is what I'm getting at. How can the parent class be changed? I > can see that it might be deferred, but I don't see how it can be > changed once it's set. The decision of which class to extend from can be made at run time: ----- main.php ----- <?php $direction = true; if ($direction) { include './core1.php'; } else { include './core2.php'; } class ext extends core { } $o = new ext; $o->func(); exit; ----- core1.php ----- <?php class core { public function func() { echo __FILE__ . "\n"; } } ----- core2.php ----- <?php class core { public function func() { echo __FILE__ . "\n"; } } --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.internals (#43914) next »