I'm building a front-controller and I need call classes with the params in the $_GET array. So, when I try this in the index.php
<?php
try{
if(filter_input_array(INPUT_GET)!==FALSE OR filter_input_array(INPUT_GET)!==FALSE){
$get = ['module'=>[FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH],
'method'=>[FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH],
'args'=>[FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH]];
$args = \filter_input_array(\INPUT_GET, $get);
//here is the problem syntax
echo (new \controller\$args['module']())->$args['method']($args['args']);
}
} catch (Exception $ex) {
echo "page not found";
}
?>
The PHP parser give me an error syntax (expected identifier).
So, how can I solve this? Do you know some possible syntax or something different method?
I want just work with OOP. Thank you to everybody (and sorry for my English, my native langague is Spanish).