Including the file will do the following:
- Read the file from disk.
- Run the code in the file.
Both of these operations take time. Not so much time, but even in this case it can add up if you have a lot of things, so the main answer to your question: "Yes, it can affect performance."
However, the size of this performance hit is quite tiny and far exceeds the benefits of writing well-structured, good-quality code (which includes storing individual classes / functions in separate files).
In truth, if you are worried about the performance of this kind of thing, try running your code through a profiler like xDebug . This will show you which parts of your code take the most time. The include() statements will appear there, but are unlikely to be anywhere near the top of the list.
If you are not writing a site with visitors such as Facebook, you are unlikely to have to worry about include() performance. But look at the exit of the profiler from xDebug, because your code will probably have other things that go much slower than you expected, or that are often called or alternate too many times, etc., And fixing these will have a big impact on the performance of your code.
Spudley
source share