I make a common variable/function file called config.php. I put in my generally used functions in it.
Suppose this is my file
CODE
<?
// -----VARIABLES --- //
$a=10,$b....
// -----FUCTIONS--- //
function doit()
{
print "A value is " . $a;
}
?>
Here, suppose we execute this file directly. Since A has a global scope, it does work perfectly.
But if this same file is imported in another file say, mainfile.php
CODE
<?
// -----VARIABLES --- //
$c,$d....
include 'config.php'; // INCLUDED THE CONFIG FILE
// now we call our function
doit();
?>
Here, the $a variable in function doit() does not work. Instead it prints only
CODE
A value is
INSTEAD OF
CODE
A value is 10

