Re: Variable (Class instantiation) collision
| From: | Brian Smither | Date: | Tue, 05 Oct 2010 21:02:55 +0000 |
| Subject: | Re: Variable (Class instantiation) collision | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308497@lists.php.net to get a copy of this message | ||
>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.