Hi I need to get the result (variable) from other PHP file. However, the included file will call some library and codes which conflicted to my codes.
For example
new.php
function getOld(){
ob_start();
include( __DIR__.'/old.php' );
return ob_get_clean();
}
$a = getOld();
var_dump($a); // able to get the result (echoed json) from old.php
define("version", "1.0"); // Warning, cannot re-defined
include "new version library" // The old version library is inited
old.php
define("version", "0.1");
include "old version library";
// Many logics here...
echo json_encode(array("id"=>........));
I know that I can use Ajax to call the file, however the server set to cannot direct call library files and many files need to changed.
Is there any faster way to get other php files result without including the codes (like a sandbox)