For files that contain functions, classes and other utilities, you generally want require_once
so that nothing is accidentally redeclared in multiple libraries (or something) and breaks stuff.
functions.php
constants.php
connection.php
For files that are templates you usually want require
, because they should be able to be included multiple times without causing issues. (Not that that's likely in the particular case of these two files.)
You never* want to use include
(or include_once
). It's like require
, but only shows a warning when the file doesn't exist - probably not what was intended.
Now you noted that your footer closes the database connection. You generally want to avoid side-effects in template files. Moreover, closing the database connection is probably unnecessary. (And given that you can close it, here's some advice: use PDO instead!)