razorsese Posted April 14, 2012 Share Posted April 14, 2012 Currently on my page all my important script is done in 1 page; I was thinking to break it in multiple php files So my question is does multiple requires slow down the PHP script?! Quote Link to comment https://forums.phpfreaks.com/topic/260938-multiple-requires/ Share on other sites More sharing options...
Drummin Posted April 14, 2012 Share Posted April 14, 2012 I really can't address the speed, but it is common to break things into useable parts to it's easier understand. Even html parts are often saved as separate sections, eg. require("header.php"); etc. It's even a good idea in mho to only require "parts" that are needed for a particular page, so doing a simple task doesn't need to scan through a huge processing page to find the matching processing script. Quote Link to comment https://forums.phpfreaks.com/topic/260938-multiple-requires/#findComment-1337363 Share on other sites More sharing options...
xyph Posted April 15, 2012 Share Posted April 15, 2012 The difference in speed is negligible. Breaking up your script logically into files is a very good idea. Quote Link to comment https://forums.phpfreaks.com/topic/260938-multiple-requires/#findComment-1337432 Share on other sites More sharing options...
PFMaBiSmAd Posted April 15, 2012 Share Posted April 15, 2012 As long as you are not including multiple 100's of files on each page request, you won't have any problem. At least one of the open source (cart) scripts was blindly reading through and including everything in multiple folders, loading 200+ files on each page request (instead of only loading what the page needed) and on the first request after a period of inactivity, since the files weren't in the disk cache, took a noticeable amount of time compared to follow-on requests that were able to read everything from the disk cache. Quote Link to comment https://forums.phpfreaks.com/topic/260938-multiple-requires/#findComment-1337511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.