Re: Variable (Class instantiation) collision

From: Date: Tue, 05 Oct 2010 21:18:25 +0000
Subject: Re: Variable (Class instantiation) collision
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-308498@lists.php.net to get a copy of this message
Short of refactoring ApplicationB, can you set it up as a SOAP/REST service that AppA calls? On Tue, Oct 5, 2010 at 5:02 PM, Brian Smither <bhsmither@gmail.com> wrote: > > >Just to clarify, both packages are instantiating and calling their > >respective classes from the $db var, which is in the global scope. > >Is this correct? > > I would say yes to the way you are asking. Take the following two > applications. The four respective statements are in each their respective > script. > > Application A: > <?php > class foo {} > $db = new foo(); > $outA = barA(); > function barA() { global $db; include("Application B"); } > ?> > > Application B: > <?php > class bar {} > $db = new bar(); > $outB = barB(); > function barB() { global $db; } > ?> > > The bridge project is operating in A and include()'ing the script that is B > (as I have not found an API for B). $db in B is colliding with $db in A. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#308498) next »