0
Route::set('test', function() {
        $class = $routes['routes']['test']['class']."::".$routes['routes']['test']['function']."();";
    });

In the $class variable is a string which is a function.

test::CreateView();

I would to run the function but i dont know how. I read some things about eval() but that doesnt seem to work.

  • 1
    Eval is evil. Use `call_user_func` instead https://www.php.net/manual/en/function.call-user-func.php – Justinas Oct 04 '21 at 13:03
  • Even using `call_user_func` instead of `eval`, this would still lead to rather bad code - what it actually does, could only be determined at runtime. Can you explain _why_ you think you need something like this in the first place? – CBroe Oct 04 '21 at 13:05

0 Answers0