# Convert decimal numbers

**URL:** <https://forum.kirupa.com/t/convert-decimal-numbers/22785>\
**Category:** Uncategorized\
**Created:** [June 8, 2003, 9:18pm UTC](https://forum.kirupa.com/t/convert-decimal-numbers/22785 "2003-06-08T21:18:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drunken](https://avatars.discourse-cdn.com/v4/letter/d/a4c791/32.png) [@Drunken](https://forum.kirupa.com/u/Drunken)\
**Post date:** [June 8, 2003, 9:18pm UTC](https://forum.kirupa.com/t/convert-decimal-numbers/22785/1 "2003-06-08T21:18:12Z")

</div>

In php i am using this to convert an decimal number to integer:

```php

$contpag = (int) ($cont/10);

```

if $cont = 17 then the result that we have is 1.7 and when convert to integer is 1, but i want that the final result to integer is 2…

thanks!

:thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 9:25pm UTC](https://forum.kirupa.com/t/convert-decimal-numbers/22785/2 "2003-06-08T21:25:55Z")

</div>

use the ceil function 🙂

[http://ca.php.net/manual/en/function.ceil.php](http://ca.php.net/manual/en/function.ceil.php)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 8, 2003, 9:39pm UTC](https://forum.kirupa.com/t/convert-decimal-numbers/22785/3 "2003-06-08T21:39:04Z")

</div>

thks it work as i want 😃
