0

I am building a site and I have used a bunch of php includes to a lot of page sections to try keep my code tidy.

While reading a beginners book on Javascript it said that I should keep my external javascript files down to a minimum because every time the client loads a file it makes a new request to the server thus slowing down the page speed.

So my question is if I have a bunch of php include files on one page is it the same principle? It probably is right?

oOPurple_HazeOo
  • 37
  • 1
  • 1
  • 9
  • possible duplicate of [PHP include Or require? and which file comes first and which right after?](http://stackoverflow.com/questions/31387186/php-include-or-require-and-which-file-comes-first-and-which-right-after) – Shehary Jul 19 '15 at 09:39
  • If you know the difference between `include` and `require` you will know where to use them. – Shaiful Islam Jul 19 '15 at 20:35
  • "The include and require statements are identical, except upon failure:" – Thanks Shaiful – oOPurple_HazeOo Jul 19 '15 at 21:10

1 Answers1

4

It is not the same principle, javascript files are downloaded and interpreted by the client; which is why you want to keep their size and number low (since bandwidth is limited).

PHP files are not downloaded by the client; they are interpreted by the server where you upload them; their output will be send to the client. This is why the number of PHP files does not have a negative impact on your page in the same way as javascript does

Sjon
  • 4,989
  • 6
  • 28
  • 46