OK, this is a bit of a complicated question concerning performance. I have to rephrase your question a bit to be able to break it down: "Should I break a large file down into smaller files and include() them together?" The answer to that is no, you shouldn't, if the only concern is the file length.
To explain I will briefly describe what occurs in the PHP engine when a request comes in. The system determines what file(s) are needed to fulfill a request. Then the main file is read into memory, and then
all files include()'d in the main file are read into memory. Then the engine parses the code and turns it into executable instructions (a lot of stuff goes on here, but it isn't important for this question). So if you have a file that is 10,000 lines of code and break it down into 5 files with 2,000 lines each, the Zend engine still has to load 10,000 lines of code into memory before anything will run. The difference is you have now piled 5 file openings onto the load time instead of just 1. Nothing was saved.
Of course, you should break files down to help you stay organized. In that case you should use classes and make smaller files in whatever way helps to keep your code neat and easy to work with.
The second part of the issue is "How long is too long?" and that is tougher to answer. If you need the logic, you need it, so there isn't a ton that can be done, but there could be some. There is a distinction between file
loading, which is what I was talking about above, and
execution. When loading, the script is read into memory like a text file and then processed to prepare for execution. There is no difference what is in the file when loading, be it class definitions, procedural code, etc. A character is a character when loading. But when
executing, a line is not a line and a character is not a character. Of course, only a line that is being executed is taking up any time during execution. So if your file has a ton of SWITCH or IF statements that are skipping a lot of code depending on logical decisions, then a large file with many lines probably won't matter for execution time because each time the file is run, only a portion of its code is actually executing. The main concern is how many instructions are actually being executed on each execution of the script.
I will say however that on a modern server, about 90% of total page server-time is spent loading and parsing scripts versus actual execution. If you have ever heard of "PHP compiler" applications, such as the one offered by the Zend company, what they are doing is pre-loading all of the PHP scripts into memory and forming the executable memory objects to cut way down on that loading time. They can be quite critical for high-traffic websites.
So I hope that answers the question. It is actually a pretty complex question to answer, but let me know if I wasn't clear on anything
