Here is my Class:
class ProcessUploadedExcel {
public static function test1($a,$b)
{
dd('hi');
}
public static function test2($a,$b)
{
dd('hi');
}
}
in another file I want to call one of the functions. So I included the file:
use App\Library\ProcessUploadedExcel;
the function is stored in a variable and when I use call_user_func_array I get an error:
ProcessUploadedExcel::test1(1,2);//works fine.
$func_name = 'test1';
call_user_func_array("ProcessUploadedExcel::" . $func_name, [1,2]);//gets error
error:
call_user_func_array() expects parameter 1 to be a valid callback, class 'ProcessUploadedExcel' not found
ProcessUploadedExcelincluded/required in the calling class ?require_once 'path/to/class.php';