Hello,
i have in an included file of a main file, a function that has
if($info){
global $info;
return true;
}
in the main file have a echo $info;
Now i know the info has data as test have proven so. But for some reason its not echoing $info how does the global $info affected in included files?
global variables
Moderator: General Moderators
your switching to the global scope too late
Code: Select all
<?php
function test()
{
$i = 0; // setting test::$i
global $i; // setting the scope of $i to global
// the local test::$i is lost
}
?>