zavin Posted April 3, 2009 Share Posted April 3, 2009 I read some place that it is a bad idea to store a lot of information in an included or required page because it could slow down the loading of the page. For example if I had 100 custom error messages all written in errors.php and for every page the needed some of these error messages I would include errors.php. Now are all 100 error messages going to load into memory every time the page is included or an error is called from the page? Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/ Share on other sites More sharing options...
ober Posted April 3, 2009 Share Posted April 3, 2009 Yes, it will load that page into memory on the server and look through it. 100 error messages isn't something I'd worry about, however. However, if these 100 messages can be categorized and only loaded in specific places, then it probably wouldn't hurt to do it. Loading that up on a page that will have no errors is just inefficient. Then again, I've seen worse coding. Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/#findComment-800415 Share on other sites More sharing options...
mrMarcus Posted April 3, 2009 Share Posted April 3, 2009 what if they are included in a page but inside an if statement that the current page does not render because the if statement does not require it to .. is the content within that statement still included in memory? Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/#findComment-800425 Share on other sites More sharing options...
premiso Posted April 3, 2009 Share Posted April 3, 2009 No, the content inside an if statement is not included in memory. To test, you can try and echo a variable inside an if statement outside, and it will not of been set. Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/#findComment-800433 Share on other sites More sharing options...
zavin Posted April 3, 2009 Author Share Posted April 3, 2009 Thanks guys that helped. Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/#findComment-800442 Share on other sites More sharing options...
mrMarcus Posted April 3, 2009 Share Posted April 3, 2009 No, the content inside an if statement is not included in memory. To test, you can try and echo a variable inside an if statement outside, and it will not of been set. that's what i figured .. just wanted to double-check .. cheers (Y) Quote Link to comment https://forums.phpfreaks.com/topic/152409-solved-include-and-require-question/#findComment-800446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.