You could easily write a simple PHP script that: opens each file in the directory, appends the needed code to that file, and closes the file. You would then rinse and repeat for every file.
EDIT: Needed to provide more details for answer.
Some pseudocode below. Note its pythonic in style (since thats what I am familiar with but the general gist is the same).
def appendCode(file):
code = "<?php require(\"footer.php\"); ?>"
with open(file, 'a') as f:
#append code here to end of file.
f.append(f)
def readDir(dir):
if isDir(dir):
d = openDir(dir)
return d.allFiles()
def main():
dirs = ["dir1", "dir2"]
for dir in dirs:
files = readDir(dir)
for f in files:
appendCode(f)
Alternatively, you could use a one liner command prompt that have been posted here or linked to! I personally enjoy writing simple programs like this just for the fun of it.