I know the difference between include
and require
by reading at following link;
Require VS Include
But if there are PHP files;
- dbconenction.php (which has all the database related code)
- index.php (which has form and
dbconenction.php
is include in it to fetch some information from database. - funtions.php (which has all the custom functions which also has the
dbconenction.php
include or require because in some functions there are queries) - site.php (which has all the site setting fetching from database and
dbconenction.php
is include or require in it) - config.php (a file which has some manually added variables)
- email-functions.php (a file which has email templates and send email functions and
dbconenction.php
andclass.phpmailer.php
is include or require in it) - class.phpmailer.php
- process.php (where i process the form, variables, functions and send email)
So in process.php
i have to include or require all files like dbconenction.php
, funtions.php
, config.php
, email-functions
and class.phpmailer.php
.
My Questions;
- If
dbconenction.php
already exist in otherPHP included or required files
do i really need to include or require it inprocess.php
? - If I don't include
class.phpmailer.php
inemail-functions.php
then which file comes first inprocess.php
?class.phpmailer.php
Oremail-functions.php
- And If I dont include or require
dbconenction.php
in any of above file besideindex.php
andprocess.php
then which files comes first and which next to it incase if one PHP file variable is dependent on other PHP file;
Reason I'm asking because I develop multiple sites in php with total custom solutions but this PHP file structure always bother me and in somecases one site PHP file structure just won't work in other site at all, sometime even no error just stuck me on blank page.