1

I have one big PHP code divided into multiple files, each one is loaded with require (exactly one time for each).

I'm curious if it's faster to have one big .php file with the whole code or different parts in different files (each part is always used).

Let's say one thousand people are refreshing the page, how much does the number of files (the code is divided in) change the speed? Which way is faster and why (what does it depend on)?

Thanks for any advice.

GerryMat
  • 13
  • 3

1 Answers1

1

It terms of processing it really doesn't make a difference, requiring is like copy/pasting the file into the file your requiring it from.

It also keeps your code more organised.

EDIT:

since the require function uses include path it will be slightly slower, but not noticeably even with 100000000's of viewers refreshing.

Robert Pounder
  • 1,490
  • 1
  • 14
  • 29