3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Geolocation { function myMethod($param1, $param2) { return $param1 . ' ' . $param2; } } $method = 'myMethod'; $params = [1, 2]; $geo = new Geolocation(); $res = $geo->{$method}(...$params); echo json_encode($res);

preferences:
66.5 ms | 404 KiB | 5 Q