I am not sure what you mean by "handles the eventual existance of methods and their calling with their respective variables", but you might be after call_user_func_array:
call_user_func_array(
array($myArray[0], $myArray[1]),
array($myArray[2])
);
If you want to do that for the concrete instance you created with $controller = new $myArray(0), replace $myArray[0] with $controller, e.g.
$controller = new $myArray(0);
call_user_func_array(
array($controller, $myArray[1]),
array($myArray[2])
);
or pass new $myArray[0] if you dont care about the instance being lost after the call
call_user_func_array(
array(new $myArray[0], $myArray[1]),
array($myArray[2])
);
Otherwise you'll get an E_STRICT notice and cannot reference $this in whatever myMethod is. Also see the PHP manual on possible callback formats.
To validate the method and class actually exist, you can use
Example:
if (method_exists($myArray[0], $myArray[1])) {
call_user_func_array(*/ … */)
}
Please clarify your question if something else is meant. On a sidenote, this was probably answered before, but since I am not sure what the question is, I am also not sure which of those to pick.