include - How to get multiple PHP files output into a single a file for further usage of those output? -


i trying output of multiple php files single php file can save them different variables further usage.

for single php file, used include , works well. multiple files don't know do.

do have experiences or advices on how achieve ?

i had 3 php files called a.php,b.php , c.php. in each file echoing array output. first php file done below save output of in fourth php file called d.php

ob_start(); include_once('a.php'); $output= ob_get_clean();  echo "<pre>";print_r($output); 

now getting second , third php files outputs.

i think want

<?php $string1 = get_include_contents('somefile1.php'); $string2 = get_include_contents('somefile2.php');  function get_include_contents($filename) {     if (is_file($filename)) {         ob_start();         include $filename;         return ob_get_clean();     }     return false; }  ?> 

Comments