I try to have my code clear part of it in files (like similar libraries). But some of these files will need to run PHP.
So what I want to do is something like:
$include = include("file/path/include.php"); $array[] = array(key => $include); include("template.php");
Than in template.php, I would:
foreach($array as $a){ echo $a['key']; }
So, I want to save what happens after php runs the variable for transmission later.
Using file_get_contents does not start php, it saves it as a string, so are there any options for this or am I out of luck?
UPDATE:
So how:
function CreateOutput($filename) { if(is_file($filename)){ file_get_contents($filename); } return $output; }
Or did you mean creating a function for each file?
source share