zggtf211 Posted March 8, 2009 Share Posted March 8, 2009 I have been working on my own web photo gallery now for about a month and i don't really know php in and out. I know a lot about Java and VB6 so i do know computer terms. I have a question specifically about includes. Say i have my main page, and when i open it, it includes foobar.php. From foobar, it then calls something else. Would the includes that foobar calls also be included in the main page? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/ Share on other sites More sharing options...
WolfRage Posted March 8, 2009 Share Posted March 8, 2009 Yes. You can include as much as you want. But remember variables in one script are now utilized in the other script if they have the same name. Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/#findComment-779595 Share on other sites More sharing options...
zggtf211 Posted March 8, 2009 Author Share Posted March 8, 2009 Is there a limit on how far back it will go before values are lost or anything? Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/#findComment-779604 Share on other sites More sharing options...
waynew Posted March 8, 2009 Share Posted March 8, 2009 If you're afraid of variables being overwritten, use require_once("filename.php"); instead of include("filename.php"); I really only use include() if what I'm including only containts HTML or something else that the main part of my code can function without. Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/#findComment-779616 Share on other sites More sharing options...
zggtf211 Posted March 8, 2009 Author Share Posted March 8, 2009 Im not too worried about over writing my variables, i just have a lot of my website connected webbed together and don't want to have too many included files and have stuff get dropped. Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/#findComment-779624 Share on other sites More sharing options...
WolfRage Posted March 8, 2009 Share Posted March 8, 2009 No in fact you can have a master include file that includes, includes of includes.... no limit, just the more you include the longer it will take to process everything as one super script.... Link to comment https://forums.phpfreaks.com/topic/148472-scope-of-includes/#findComment-779835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.