Iank1968 Posted February 25, 2009 Share Posted February 25, 2009 I want to split my common.php into 2 smaller files and still be read by the common.php file. Someone told me how to awhile ago but I cant find the thread. I also understand that splitting the file into 2 smaller files eleviates some strain on the server, is that true? Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/ Share on other sites More sharing options...
genericnumber1 Posted February 25, 2009 Share Posted February 25, 2009 I'm not sure I understand. You'd have to post the contents of common.php for us to tell you how to split it into 2 smaller files and under what circumstances it would increase or decrease strain on the server. Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/#findComment-770685 Share on other sites More sharing options...
samshel Posted February 25, 2009 Share Posted February 25, 2009 as far as i understand, splitting files does not have anything to do with server strain. The code is anyways going to be executed if u include them. For splitting it is entirely developers decision whether to split them into 2 or more files and how to do that. you can just put some code in functions and copy the functions in another file, include it and use the functions. Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/#findComment-770687 Share on other sites More sharing options...
Iank1968 Posted February 25, 2009 Author Share Posted February 25, 2009 wel the code Iam using is a game, and when several people play it at the sametime my server goes nuts and crashes. server goes from 2 to 13 and crashes. most of it isnt my code and the guy who wrote the code isnt around anymore. Its probably way to mush to ask someone to actually go threw it and recommend ways to streamline it and find where the loops is thats causing the crashes, if thats what it is. I was told that splitting the file puts less strain on the server, but I wanted to ask here about that claim. Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/#findComment-770702 Share on other sites More sharing options...
MatthewJ Posted February 25, 2009 Share Posted February 25, 2009 samshel is right... When you include files, it is like copying and pasting all of the code that is included right where the include statement is, so for your benefit they are in two files, but the parser sees it as one big file. I would say it is time for a stronger server Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/#findComment-770705 Share on other sites More sharing options...
genericnumber1 Posted February 25, 2009 Share Posted February 25, 2009 Well, it is possible to split an include in such a way that only half is included in some places, thus decreasing the strain on the server. It really depends on what's being included. I would say it is time for a stronger server Or some refactoring Link to comment https://forums.phpfreaks.com/topic/146789-what-function-do-i-use-to-split-a-rather-large-common-file/#findComment-770718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.