# Routing with floats in the URL

**URL:** <https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195>\
**Category:** Questions\
**Created:** [February 26, 2017, 3:15pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195 "2017-02-26T15:15:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nycran](https://avatars.discourse-cdn.com/v4/letter/n/ecc23a/32.png) [@Nycran](https://discourse.slimframework.com/u/Nycran)\
**Post date:** [February 26, 2017, 3:15pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195/1 "2017-02-26T15:15:39Z")

</div>

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’);

/calculator/1/5/5

works, but

/calculator/1/5/5.5

does not?

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

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![llvdl](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llvdl/32/78_2.png) [@llvdl](https://discourse.slimframework.com/u/llvdl)\
**Post date:** [February 26, 2017, 9:23pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195/2 "2017-02-26T21:23:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nycran](https://avatars.discourse-cdn.com/v4/letter/n/ecc23a/32.png) [@Nycran](https://discourse.slimframework.com/u/Nycran)\
**Post date:** [February 26, 2017, 10:00pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195/3 "2017-02-26T22:00:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![llvdl](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llvdl/32/78_2.png) [@llvdl](https://discourse.slimframework.com/u/llvdl)\
**Post date:** [February 27, 2017, 8:34pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195/4 "2017-02-27T20:34:01Z")

</div>

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 [https://gonzalo123.com/2012/10/15/how-to-rewrite-urls-with-php-5-4s-built-in-web-server/](https://gonzalo123.com/2012/10/15/how-to-rewrite-urls-with-php-5-4s-built-in-web-server/).

---

<div class="post-metadata">

**Author:** ![Nycran](https://avatars.discourse-cdn.com/v4/letter/n/ecc23a/32.png) [@Nycran](https://discourse.slimframework.com/u/Nycran)\
**Post date:** [February 27, 2017, 8:36pm UTC](https://discourse.slimframework.com/t/routing-with-floats-in-the-url/1195/5 "2017-02-27T20:36:15Z")

</div>

Much appreciated, thank you!
