Right now I have a script that has reached 400 KB in 4 files (about 3500 lines per file).

Should I split it into more files?

Does having more files have a impact on performance because of multiple require_once calls?

Accepted Answer

I have a large, 13000 line script that I combined from three others, but it's entirely view and user-management related, dealing with output and receiving input. The functions are in another, 8000 line file, and I make sure there's zero bleedover between the two. No HTML in the functions file, no SQL in the main file. Would this be different if I could use objects? Of course. Can't.

So the moral of the story is: It all depends on what makes you comfortable for the script in question. I have one other that is 5 small files because it makes more sense that way; this one makes sense as two large ones.

Written by Andrew
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki