Using class inside a function giving error("Class Not Found");
When using outside function it works. For example -
require_once 'DoR/autoload.php';
use DoR\DoR;
use DoR\PSR\DoRx;
$dor = new DoR($agent);
$report = $dor->report();
When used within a function it gives error ("CLASS NOT FOUND"), For Example-
function runDOR($agent){
require_once 'DoR/autoload.php';
$dor = new DoR($agent);
$report = $dor->report();
return $report;
}
$report = runDOR();
Is their any alternative to having use satements for functions.