I currently use a one file design... where all my php code is in one index.php file, I have about 13,000 lines (~1mb) in one file, and it is starting to hang a little on load time... I was thinking it could be the file size, but I had always thought PHP is preprocessed on the server, so it doesn't matter what is in the other if statements, because it won't be rendered.
Below is an example of my index.php:
if ($_POST['action'] == 'view') {
// code
} else if ($_POST['action'] == 'something') {
// code
} else if ($_POST['action'] == 'otherthings') {
// code
} else {
// homepage
}
Questions:
- Am I losing any speed by having my code in one file? or does this not affect the speed at all?
- Are there any code layout/organizational styles that are more efficient for PHP? or does this not matter either?