I call it "Compartmentalization", that is, taking a long .php file and breaking it down into smaller components; Seperate .php files.

This will keep everything tidier, cleaner, more organized, reusable and I believe, more secure.

Example (Not my code - Maybe not a perfect example of this idea, but for illustration sake):


$server = "";
$dbuser = "";
$dbpass = "";
$database = "";


What is this called?

Can anyone direct me to an online resource detailing this? Best practices. I need to do this and I need to do it correctly.

Thank you in advance!

It's a modular approach. However, perhaps since you are redesigning anyway, you can try an Object Oriented approach.

commented: Great programmer & tutor! Thank you, Pritaeas. +7

I just viewed your link on the OO approach. Very nice and educational.

I am trying to envision how this would work with my project. Not sure yet.

Although I am having some issues with the coding, the project is not as large on the back-end as people may assume. I will be storing much data, but the actual processing is simple.

One of my main concerns is security (A topic for a later time).

I will have to keep in mind your fine example of the keycard/lock. How does this relate to this project? (Rhetorical)

I believe this approach may be good when handling the registration of new Users, a process more complex than people think. Plus, I'm building my own, advanced Captcha system, so the OO approach may work there great. Also, I'm designing a security-bot; More on that in the future.

Thank you for your help!

If you do not want to go OOP just yet, you can divide your code into logical functions and separate them into include files. Basically that's the first step, whether you use functions or classes.