If you include a file within a function, that file will be loaded in that function's scope. Example:

<?php

function test()
{
   include 'a.inc.php';
}

test();

echo isset($a) ? '$a is set' : '$a is not set', ".\n";

include 'a.inc.php';

echo isset($a) ? '$a is set' : '$a is not set', ".\n";

?>

The same happens if b.class.php is included within a function (or class member, etc.) and includes a.inc.php, as in your example (I am presuming.)

If this is the problem, I suggest simply adding:

global $a;

At the top of a.inc.php, which will solve the problem for you.

-[Unknown]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to