---
title: "ta bort decimaler och avrunda?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/15515-ta-bort-decimaler-och-avrunda"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Neo"
published: "2001-04-18T10:13:00.000Z"
updated: "2001-04-18T10:27:00.000Z"
replies: 2
views: 697
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/15515-ta-bort-decimaler-och-avrunda"
---

# ta bort decimaler och avrunda?

## #1 — Neo, 2001-04-18T10:13Z

Hur tar jag bort decimaler ur ett resultat och avrundar upp eller ner?

exempel:

$procent = $svar1/$svar1total;

Permalänk: https://www.webforum.nu/p/15515

## #2 — woodi, 2001-04-18T10:19Z

$procent = number_format($svar1/$svar1total,2);

Detta ger Dig två decimaler.. 

Funktionen ceil(); avrundar ett tal uppåt.
Funktionen floor(); avrundar ett tal neråt..  

Läs mer i manualen om dessa kommandon.

Permalänk: https://www.webforum.nu/p/318195

## #3 — Neo, 2001-04-18T10:27Z

Tack woodi!

You´re the man!

Permalänk: https://www.webforum.nu/p/318196

---

Tråden på webben: https://www.webforum.nu/amne/php/15515-ta-bort-decimaler-och-avrunda
