I want to simplify files including or requiring process in PHP a little bit, so I wrote the function:
$files = array("filename", "other_filename");
function required_files($filenames) {
foreach ($filenames as $filename) {
require_once("admin/files/".$filename.".php");
}
}
required_files($files);
It doesn't work unfortunately, but I know it's being processed by PHP, because whenever I change the "filename" to a name of the file, which doesn't exist, I got the error about that file is not existent. What am I doing wrong here?
PS: I tried to echo
or return
require_once()
but no effect.
EDIT
That's within Wordpress template's functions.php.