php - Fatal error: Cannot redeclare with call_user_func() -


i'm trying execute couple of tests in groups each 1 .php file contains 2 functions. problem each test given group has clean-up function same name (for example test10_cleanup, 10 group number). after execution of code:

$dir = __dir__ . "/tests/"; $tests = array_slice(scandir($dir), 2);  foreach ($tests $test) {     include("{$dir}{$test}");   $arr = get_defined_functions();    //weird note: user defined functions in reverse order   //cleanup function in array's first element   call_user_func($arr["user"][1]);   call_user_func($arr["user"][0]);    unset($arr); } 

it seems unsetting , getting again defined functions not clearing previous ones. so, fixable procedural code rather using oop or should go straight ahead , exec new php process each test file?


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -