Hi.
I created these PHP scripts, in order to execute 'foo.php' by using 'ob_start' via another script ('admin.php').
'foo.php' requires some libraries ('functions_for_foo.php' where some arrays are handled) and 'admin.php' requires other libraries ('functions_for_admin.php').
array_info.php
$myList = array ("John", "Mary");
foo.php
require_once("array_info.php");
require_once("functions_for_foo.php");
manageArray();
functions_for_foo.php
function manageArray()
{
global $myList;
print_r($myList);
}
admin.php
// OPTION 1
// require_once("functions_for_admin.php");
// doInclude();
// END OPTION 1
// OPTION 2
ob_start();
chdir('/usr/local/httpd/htdocs/');
include('/usr/local/httpd/htdocs/foo.php');
$out = ob_get_contents();
ob_end_clean();
print "<li>GOT CONTENTS:\n";
print $out;
// END OPTION 2
functions_for_admin.php
function doInclude()
{
ob_start();
chdir('/usr/local/httpd/htdocs/');
include('/usr/local/httpd/htdocs/foo.php');
$out = ob_get_contents();
ob_end_clean();
print "<li>GOT CONTENTS:\n";
print $out;
}
If I execute 'admin.php' with 'OPTION 2' (without calling 'functions_for_admin.php'), I can display info ($out) from array, but I use 'OPTION 1' (calling 'functions_for_admin.php'), this info dissapears.
Just the same if I don't call 'functions_for_foo.php' within 'foo.php' (got array info if I don't call functions).
Any similar experience?
Thank you very much.