I have a quick question on efficiency in php. I was just wondering if it would be more efficient, less efficient or if it really doesn’t matter if I design a php program with basically all of the code in one file (index.php), using $_GET’s to decide what to show/do on the page, or should I just use a switch statement with includes to multiple files.
For example, lets just say that a user wants to reach the login section of my site. First, the user would just be in the no modification index.php, and once the user clicks on the “Login” link, he will then be taken to index.php?mod=login. Inside index.php, there will be an if statement that will check for “mod” to be set, and if so, then it will go through the possible outcomes, catching on the “login” section. All of the code for logging in, including the HTML, will be inside this switch/if statement.
Would it be better to just include “login.php” instead of containing all of the code in the same file?
Does the server have to parse even code that doesn’t get executed, as in code within false if statements?
Sorry for the long post, and if you don’t understand, I can try to clarify it up a bit.