If I use too many
includes on my page will it slow it down or something?
The include doesn't slow down the page, but the content of the file that will be included.
The performance depends on the content of your file that will be included, for example, too many FOR cycles make the script slower, a database connection with a poorly built query , etc…
The best thing would be to look for how to improve your php script performance, development best practices, etc…
Only the include function will not affect performance. Now if you compare a require() with an include() yes, require is slower compared to include .
Use absolute paths when calling files, so php won't need to parse the
Here are some examples of good practices for you who are just starting out:
- The php manual will be your best friend and will answer (almost) all your questions.
- Look for DRY(Don't Repeat Yourself) and KISS(Keep It Simple Stupid) practices , in other words, don't repeat code and keep everything stupidly simple.
- Beauty is not essential, but a well-organized code makes the system much easier to maintain.
- Use comments, but remove them in the production used version, comments are welcome but make the arches heavier (next item completes this)