Jump to content

[SOLVED] Include and require question.


zavin

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.