Routing with floats in the URL

Hi guys, sorry if this is a silly question but any idea why, given a routing rule of:

$app->get(’/calculator/{operator}/{parameter1}/{parameter2}’, CalculatorHandler::class . ‘:calculate’);


works, but


does not?

I’ve tried adding a regular expression to the parameter2 routing rule, but no luck there either.

Thanks in advance.

Are you using the PHP built-in web server? It may actually try to look for a file called 5.5 instead of calling the Slim front controller.

Thanks for your reply. Yes I am. Is there anything that can be done to make the route work? If not, I’ll just switch to posting the parameters instead.

You can use index.php/calculator/1/5/5.5 instead of calculator/1/5/5.5 in the URL to ensure that the PHP built-in web server calls the front controller (index.php).

Another option is to use a router script when starting the built-in web server, see for example

1 Like

Much appreciated, thank you!