Jeric Javier Jeric Javier - 5 months ago 23
PHP Question

rounding off decimal in php

$discount = $total * $disc;

I have this php code but sometimes it results into a decimal how can I round it off. One case is $discount = 157 * .20. I want to round it off so there will be no decimal.

Answer Source

$discount = floor($total * $disc); or $discount = ceil($total * $disc);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download