How to get 3 parameters from the url with slim 4

Hello, I also wanted to highlight the other way to receive multiple parameters through the url with slim 4, as the documentation says:
url example:
http://api_slim_base.jl/users/1/news/Jose/jlr/12345678

function example

$group->get(‘/news[/{params:.*}]’, function ($request, $response, array $args) {
// $params is an array of all the optional segments
$params = explode(‘/’, $args[‘params’]);
//…
$response->getBody()->write("Name: “.$params[0].”, login: “.$params[1].”, password: ".$params[2]);
return $response;
})->setName(‘news’);

Which way is the best?
Is there any advantage to using one or the other?