ciber Posted November 21, 2010 Share Posted November 21, 2010 Hi, Basically I am going to give a short description to my problem with pseduo and comments (-->), there is too much to paste all my code here: basically include(config.php) --> database connection include(global.php) --> class is instantiated here as $p ($p is GLOBAL) --> I print_r the $p value here, and it shows (debugging) switch() case x: include file.php; break; --> but when I try to access it or print_r it here (here being within the file.php), via the file that has been included above "include file.php", it does not see it. I have to re-declare the $p variable with the class, within the included file. any tips as how to solve this please; I dont see why it wouldnt see it, since all the file is that I am including is an HTML file with a few PHP lines, which checks if a user has permission: if(!$p->check()) redirect("index.php"); Link to comment https://forums.phpfreaks.com/topic/219362-class-declared-but-not-seen/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 21, 2010 Share Posted November 21, 2010 Best guess is you are using a URL in your include statement. That does not include the code in the included file into the current program's scope and so does not make variables in the main program scope available in the included code. Second best guess, you are expecting a main program variable to be available in the local scope of a function definition and they are not. Posting actual code that demonstrates/duplicates the problem is the quickest way of getting help. Link to comment https://forums.phpfreaks.com/topic/219362-class-declared-but-not-seen/#findComment-1137482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.