I'm making a controller, which calls a different method from a class and I want to make it as generic as possible. I currently have this code:
//More code up, just showing the important code part
$geo = new Geolocation();
$res = $geo->{$method}(...$params);
echo json_encode($res);
What I want is pass an array as arguments to my Geolocation class.
I took an idea from the next thread: Passing an Array as Arguments, not an Array, in PHP
The problem is that "splat operator" ...
is not working for me, probably because it's not a function. Is there any related solution?
PHP 5.6.20