[PHP] Global unavailable?

2005-10-05 Thread Marcus Bointon
I have a simple situation: in a.inc.php: $a = 1; in b.class.php require 'a.inc.php'; class b { function test() { global $a; echo $a; } } With this pattern, $a is NOT visible within class b, even though it is declared in the global scope and I'm using the global

Re: [PHP] Global unavailable?

2005-10-05 Thread Jochem Maas
Marcus Bointon wrote: I have a simple situation: in a.inc.php: $a = 1; in b.class.php require 'a.inc.php'; class b { function test() { global $a; echo $a; } } With this pattern, $a is NOT visible within class b, even though it is declared in the global scope and

Re: [PHP] Global unavailable?

2005-10-05 Thread Marcus Bointon
On 5 Oct 2005, at 13:37, Jochem Maas wrote: if changing the declaration in a.inc.php fixes it then you must NOT be including b.inc.php form the global scope. Well, that's what I thought, but it just isn't! The include really is in the global scope outside any class or function definition.

Re: [PHP] Global unavailable?

2005-10-05 Thread Jochem Maas
Marcus Bointon wrote: On 5 Oct 2005, at 13:37, Jochem Maas wrote: if changing the declaration in a.inc.php fixes it then you must NOT be including b.inc.php form the global scope. Well, that's what I thought, but it just isn't! The include really is in the global scope outside any class