Post by Dayo is ignored |
Re: GLOBALS.php "Bug"?? |
Thu, 28 April 2011 09:20 |
|
If you include something in a function, the result will be local unless specifically defined as global within the function.
So if you include the file outside the function, it will be global or "public" using .NET terminology.
If you want to be able to access a local variable outside the parent function you have to declare it global or supergloba, either by declaring it within the global scope, or defining it as global within the function.
If that makes sense?
From the bottom of my heart I do not mean any offense, but I think you are mistaking this as a structural issue whereas in you are just "doing it wrong" as the lolcat would have said. But, I have been wrong a million thousand billion times before and this could sure as hell be one of those times again.
|
|
Post by Dayo is ignored |
Re: GLOBALS.php "Bug"?? |
Wed, 27 April 2011 08:55 |
|
I see, and referencing the variables as globals within the function as I suggested does not work?
|
|
Post by Dayo is ignored |
Re: GLOBALS.php "Bug"?? |
Sun, 24 April 2011 11:50 |
|
You need to define it as global in your function since it is included.
IE
<?php include('globals.php');
function Function() {
global $global, $global2, $etc;
echo $global;
} ?>
|
|
Post by Dayo is ignored |