Which coding style is better?
having one file that does all functions.
- index.php?action=add
- index.php?action=edit
- index.php?action=delete

index.php does and if/switch statement to include which files needed for which action.
ie.
if ($action == 'add') {
include('add.php');
add();
} else if ($action == 'edit') {
include('edit.php');
edit();
}

OR
having multiple files doing only one function?
- add.php
- edit.php
- delete.php

Is there a big performance loss if done using one file? Any comments?

    I always use one file, makes things cleaner.

    UNLESS you are repeating code over and over, then use other files, that looks good to me.

      ok great...

      I just want to find ways to code scripts efficiently and also optimize scripts for speed. I haven't found any articles that gives tips and trick on how to code your scripts.

        Write a Reply...